Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

Visual Studio 2017 fails to create an archive

$
0
0

HI guys,
I'm trying to create a package for my Android application but I received an error:

The selected build configuration is using the shared Mono runtime

but in Release mode this is unchecked. I deleted the .vs folder as a lot of guys suggested.


why my ToolbarItem Icons are visibiling in white color(original one's are in orange color)

$
0
0

hi all,
why my ToolbarItem Icons are visibiling in white color(original one's are in orange color) in navigationpage.(NavigationPage.SetHasNavigationBar(this, false) in that page)

Convert Portable to Shared Project?

$
0
0

Hi guys,

we have several (older) Apps developed with PCL (Portable). When I start a new project with Visual Studio 2017 i get a shared project. Is it recommended to change our older Apps to Shared Project? If so, can I convert somehow?

Best regards
Chris

Parsing JSONString

$
0
0

Hi
I have trouble parsing my JSONstring retrived from my url.
below is my JSONString
php_resp = "{\"customer\":\"turkerler\",\"authority\":\"1023\",\"url\":\"http:\/\/gultekinteknik.com.tr\/file\/TURKERLER-LOGO1.png\",\"message\":\"Welcome\"}"

I need your urgent help guys! Thanks in advance.

FirebasePushNotificationPlugin

$
0
0

HI,
I am using Firebse Push notification plugin - https://github.com/CrossGeeks/FirebasePushNotificationPlugin
in Android , we can define the activity to be shown when the notification is clicked - FirebasePushNotificationManager.NotificationActivityType
Is there similar way to define for ios.
Currently when clicking on push notification the app crashes on ios.

Use MobileAppService in a device

$
0
0

Hi,
I've created a new project with Include ASP.NET Core Web API project. Definitely amazing for tests in a local machine. I want to use it for tests purpose also in some real devices so my testers can play quickly and check different scenarios.

Is it a way to do that? Thank you in advance!

How to Enlarge the image when we tap on it?

$
0
0

My requirement is when i clicked on the image i need to show image as zoom out

FreshMVVM Master detail with custom MasterPage

$
0
0

Hello
I use FRESHMVVM in my app.
I created a massterdetail page as well:

var masterPage = FreshPageModelResolver.ResolvePageModel();
var detailPage = FreshPageModelResolver.ResolvePageModel();
var masterDetailNav = new FreshMasterDetailNavigationContainer();
masterDetailNav.Init("Menu");
masterDetailNav.Master = masterPage;
masterDetailNav.Detail = detailPage;
MainPage = masterDetailNav;
}

I would like that when a MenuItem is pressed it is navigated to the new page keeping the menu present.

I am doing this way but the new page is opened without menu.

await CoreMethods.PushPageModel(item.ViewModelType);

Can you help me?
Thank you


Some model between Xamarin and ASP.NET Core 2

$
0
0

Hi guys,
I'm creating Xamarin apps. Those apps connect to my real webapi. I want to share the Models project between webapi project and Xamarin.

Webapis are in .NET Core 2.x and Xamarin in .NET Standard 2.x

Is it possible to do that?

Thank you in andvance

How can i create Keystore for Android publish to Play Store?

$
0
0

How can i create the Key store.Is it require any credentials from the organization?

Can't archive my android project, "this package may not be fully compatible"

$
0
0

Whenever I try to archive my android project into an APK, I get this warning which prevents me from archiving:

Package 'Plugin.MediaManager 0.4.51' was restored using '.NETFramework version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.01. This package may not be fully compatible with your project.

The project builds just fine. Any ideas? The plugin I'm using 'Plugin.MediaManager' is essential and I need it in my project.

Thanks

Getting a empty list inside a button click Xamarin.Forms

$
0
0

I am new to Xamarin and MVVM. In my application I have Tabbed page and I have two child views inside. I am making a network call and getting data from databse in my first child's view model. Data is coming. I wanted to pass some data to my second child(List). I was able to pass data correctly. Inside my second child, I have a button and calling a new Page.

First child's ViewModel...

public async Task getFypDataAsync(string accessToken)
{

    fypFullList = await _apiServices.GetFypData(accessToken);

    fypFullList.Sort((x, y) => x.rank.CompareTo(y.rank));


    fypSendList.AddRange(new List<FypRankData>(fypFullList.GetRange(0, 320)));

    new HomeTab2(fypSendList); // send data to second child

}

List's data is available inside my second child's constructor (code behind).

Second child's code behind....

public partial class HomeTab2 : ContentPage
    {

        bool _istapped = false;
        public List<FypRankData> mylist = new List<FypRankData>();

        public HomeTab2()
        {

            InitializeComponent();

            BindingContext = new HomeTabVM2();

            var vm = BindingContext as HomeTabVM2;
            vm.setFypData();

        }

        public HomeTab2(List<FypRankData> fypSendList)
        {

            mylist = fypSendList;
            Debug.WriteLine(fypSendList.Count.ToString(), " list_yyycount ");

        }

    private async void Btn1_Clicked(object sender, EventArgs e)
    {
        if (_istapped)
            return;

        _istapped = true;

        await Navigation.PushAsync(new ChartPage(mylist));

        _istapped = false;
    }

}

Problem is inside the button click mylist is getting empty. But inside the constructor, value is assigning.

errors when loading templates in cross-platform in c #

$
0
0

errors when loading templates in cross-platform in c #
When I start c # I load all the templates to fit emulaodres de xamarin and the jdk and I disappear most of the plants.
I have installed the visual version 2015

How to consume a local HTTPS ASP.NET Core 2.1 API from Android and iOS simulators

$
0
0

I'm working on a Xamarin.Forms app that requires to consume some data exposed in an ASP.NET Core 2.1 API, I'm developing the service and the Xamarin app so everything is running local on MAC OS.

The problem I'm facing is happening when sending a request to the ASP.NET Core API, it seems to be related to the HTTPS protocol enabled by default in ASP.NET Core 2.1, when I run the api it's enabling by default the URL localhost port 5001 so that is the URL I'm targeting in the Xamarin App.

In Android I can send the request to the API but once the response is sent back, the xamarin app throws the following exception:

Error in AppLoginViewModel.Login Javax.Net.Ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. ---> Java.Security.Cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. ---> Java.Security.Cert.CertPathValidatorException: Trust anchor for certification path not found.
    --- End of inner exception stack trace ---
    --- End of inner exception stack trace ---
at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <fb2a9245146c43afbafe6628542c6726>:0 
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00014] in <fb2a9245146c43afbafe6628542c6726>:0 
at Javax.Net.Ssl.HttpsURLConnectionInvoker.Connect () [0x0000a] in <9c89490198b4401e89a0f0bf9e68c7be>:0 
at Xamarin.Android.Net.AndroidClientHandler+<>c__DisplayClass43_0.<ConnectAsync>b__0 () [0x0005a] in <9c89490198b4401e89a0f0bf9e68c7be>:0 
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <5b7c58d953774179ac771c086a8fa093>:0 
at System.Threading.Tasks.Task.Execute () [0x00000] in <5b7c58d953774179ac771c086a8fa093>:0

In iOS the behavior is the same, the xamarin app throws an exception when receiving the response

Error in AppLoginViewModel.Login System.Net.WebException: An SSL error has occurred and a secure connection to the server cannot be made. ---> Foundation.NSErrorException: Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSErrorPeerCertificateChainKey=(
    "<cert(0x7fce57040e00) s: localhost i: localhost>"
), NSErrorClientCertificateStateKey=0, NSErrorFailingURLKey=https..., NSErrorFailingURLStringKey=https... NSUnderlyingError=0x600001fccc60 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x6000023ce400>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9802, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9802, kCFStreamPropertySSLPeerCertificates=(
    "<cert(0x7fce57040e00) s: localhost i: localhost>"
)}}, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <31AF1DE2-4C56-4480-9F1D-0E9B7C7B8D9A>.<1>"
), _kCFStreamErrorCodeKey=-9802, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <31AF1DE2-4C56-4480-9F1D-0E9B7C7B8D9A>.<1>, NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x6000023ce400>, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made.}
   --- End of inner exception stack trace ---

I did try installing the self signed certificate (created by asp.net core) in both simulators with no luck, the result is the same

Visual Studio 2019 Preview 2: Can't create Windows UWP project using Xamarin.Forms

$
0
0

Hello, I'm learning to develop both Windows(UWP) and Android app using Xamarin.Forms. When I heard the news that Visual Studio 2019 Preview 2 came to availability, I decided to give it a try.

However, when I tried to create a new Cross-Platform Xamarin.Forms project for both Windows and Android, 'Windows' checkbox was missing on 'select a template' screen, which is currently available on Visual Studio 2017.

Why is that? I know that I can add an Windows project later on after I create an Android-only project, but that process is kinda annoying. Are Microsoft and their Xamarin team going to drop Windows support in the later iteration of Visual Studio and Xamarin? or will they reactivate the option later on?


NSFilePromiseProvider any sample?

$
0
0

It is interesting that NSFilePromiseProvider is being highlited and featured in several documents like: https://docs.microsoft.com/en-us/xamarin/mac/platform/introduction-to-macos-sierra/modern-cocoa-apps, while it seems not to be fully implemented and possibly not even useful in the current implementation, as at least this API is not implemented and it seems to be critical: https://developer.apple.com/documentation/appkit/nsfilepromiseproviderdelegate/1644244-filepromiseprovider?language=objc

Anyway any sample code for Xamarin (truth to be code not much samples for objective C/swift either)? Especially samples with NSTableView would be appreciated.

Custom ScrollView renderer does not work scroll

$
0
0

I create custom ScrollView.
This is done so that the swipes and scrolls work.
I need to make a vertical scroll.
Help me please

`
public class GestureScrollView : ScrollView
{
public event EventHandler SwipeDown;
public event EventHandler SwipeTop;
public event EventHandler SwipeLeft;
public event EventHandler SwipeRight;

    public void OnSwipeDown() =>
        SwipeDown?.Invoke(this, null);

    public void OnSwipeTop(float y)
    {
        SwipeTop?.Invoke(this, null);
    }

    public void OnSwipeLeft()
    {
        SwipeLeft?.Invoke(this, null);
    }

    public void OnSwipeRight()
    {
        SwipeRight?.Invoke(this, null);
    }
}`

Android

`[assembly: ExportRenderer(typeof(GestureScrollView), typeof(Swipe.Droid.Platform.Renderers.GestureScrollViewRenderer))]
namespace Swipe.Droid.Platform.Renderers
{
public class GestureScrollViewRenderer : ScrollViewRenderer
{
readonly CustomGestureListener _listener;
readonly GestureDetector _detector;

    public GestureScrollViewRenderer(Context context) : base(context)
    {
        _listener = new CustomGestureListener();
        _detector = new GestureDetector(context, _listener);
    }

    public override bool DispatchTouchEvent(MotionEvent e)
    {
        if (_detector != null)
        {
            _detector.OnTouchEvent(e);
            base.DispatchTouchEvent(e);
            return true;
        }
        return base.DispatchTouchEvent(e);
    }

    public override bool OnTouchEvent(MotionEvent ev)
    {
        base.OnTouchEvent(ev);

        if (_detector != null)
            return _detector.OnTouchEvent(ev);

        return false;
    }

    protected override void OnElementChanged(VisualElementChangedEventArgs e)
    {
        base.OnElementChanged(e);

        if (e.NewElement == null)
        {
            this.GenericMotion -= HandleGenericMotion;
            this.Touch -= HandleTouch;
            _listener.OnSwipeLeft -= HandleOnSwipeLeft;
            _listener.OnSwipeRight -= HandleOnSwipeRight;
            _listener.OnSwipeTop -= HandleOnSwipeTop;
            _listener.OnSwipeDown -= HandleOnSwipeDown;
        }

        if (e.OldElement == null)
        {
            this.GenericMotion += HandleGenericMotion;
            this.Touch += HandleTouch;
            _listener.OnSwipeLeft += HandleOnSwipeLeft;
            _listener.OnSwipeRight += HandleOnSwipeRight;
            _listener.OnSwipeTop += HandleOnSwipeTop;
            _listener.OnSwipeDown += HandleOnSwipeDown;
        }
    }

    void HandleTouch(object sender, TouchEventArgs e)
    {
        _detector.OnTouchEvent(e.Event);
    }

    void HandleGenericMotion(object sender, GenericMotionEventArgs e)
    {
        _detector.OnTouchEvent(e.Event);
    }

    void HandleOnSwipeLeft(object sender, EventArgs e)
    {
        var _gi = (GestureScrollView)this.Element;
        _gi.OnSwipeLeft();
    }

    void HandleOnSwipeRight(object sender, EventArgs e)
    {
        var _gi = (GestureScrollView)this.Element;
        _gi.OnSwipeRight();
    }

    void HandleOnSwipeTop(object sender, EventArgs e)
    {
        var _gi = (GestureScrollView)this.Element;
        _gi.OnSwipeTop();
    }

    void HandleOnSwipeDown(object sender, EventArgs e)
    {
        var _gi = (GestureScrollView)Element;
        _gi.OnSwipeDown();
    }
}

public class CustomGestureListener : GestureDetector.SimpleOnGestureListener
{
    private static int SWIPE_THRESHOLD = 100;
    static readonly int SWIPE_VELOCITY_THRESHOLD = 100;

    MotionEvent mLastOnDownEvent;

    public event EventHandler OnSwipeDown;
    public event EventHandler OnSwipeTop;
    public event EventHandler OnSwipeLeft;
    public event EventHandler OnSwipeRight;

    public override bool OnScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
    {
        return base.OnScroll(e1, e2, distanceX, distanceY);
    }

    public override bool OnDown(MotionEvent e)
    {
        mLastOnDownEvent = e;

        return true;
    }

    public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
    {
        Console.WriteLine("OnFling");

        if (e1 == null)
            e1 = mLastOnDownEvent;

        float diffY = e2.GetY() - e1.GetY();
        float diffX = e2.GetX() - e1.GetX();

        if (Math.Abs(diffX) > Math.Abs(diffY))
        {
            if (Math.Abs(diffX) > SWIPE_THRESHOLD && Math.Abs(velocityX) > SWIPE_VELOCITY_THRESHOLD)
            {
                if (diffX > 0)
                    OnSwipeRight?.Invoke(this, null);
                else
                    OnSwipeLeft?.Invoke(this, null);
            }
        }
        else if (Math.Abs(diffY) > SWIPE_THRESHOLD && Math.Abs(velocityY) > SWIPE_VELOCITY_THRESHOLD)
        {
            if (diffY > 0)
                OnSwipeDown?.Invoke(this, null);
            else
                OnSwipeTop?.Invoke(this, null);
        }

        return base.OnFling(e1, e2, velocityX, velocityY);
    }
}

}`

Xaml:

<ctrl:GestureScrollView x:Name="gi"> ... </ctrl:GestureScrollView>

C#:

`gi.SwipeDown += (s, e) =>
{
DisplayAlert("Gesture Info", "Swipe Down Detected", "OK");
// scroll down
};

        gi.SwipeTop += (s, e) =>
        {
            DisplayAlert("Gesture Info", "Swipe Top Detected", "OK");
            // scroll top
        };

        gi.SwipeLeft += (s, e) =>
        {
            DisplayAlert("Gesture Info", "Swipe Left Detected", "OK");
            ((NewsFeedDetailPageModel)BindingContext).OpenSourceCommand.Execute(null);
        };

        gi.SwipeRight += (s, e) =>
        {
            DisplayAlert("Gesture Info", "Swipe Right Detected", "OK");
            ((NewsFeedDetailPageModel)BindingContext).BackCommand.Execute(null);
        };`

How can we apply MVVM pattern in xamarin.android step by step

$
0
0

How can we apply MVVM pattern in xamarin.android step by step

How To Select Multiply Images And Send Them To Server in as A stream content ?

$
0
0

I need To Get Some Images Form Phone And Send Them to Server , I'm Trying To Select 1 Image and Send it To PHP Backend WebService as a Stream Content . Thanks

I need to help Multipart for to send a image to server

$
0
0

Hi! My first time here
I need to help to send a image to server with Multipart.
I tried but without sucess. A tutorial ?

Viewing all 204402 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>