Xamarin Forms Android App Crashes Running Debug with VS Android Emulator

In short: 1. “Could not connect to the debugger” issue (Android app starts and immediately closes, debugging stops): Close the Android simulator window to shut down the virtual machine. Start the “Hyper-V Manager” (Microsoft program to manage virtual machines in Windows, you have it installed) Select the emulator you are trying to use Right-click for … Read more

What is the difference between Xamarin.Form’s LayoutOptions, especially Fill and Expand?

Short answer Start, Center, End and Fill define the view’s alignment within its space. Expand defines whether it occupies more space if available. Theory The structure LayoutOptions controls two distinct behaviors: Alignment: How is the view aligned within the parent view? Start: For vertical alignment the view is moved to the top. For horizontal alignment … Read more

Ignore SSL certificate errors in Xamarin.Forms (PCL)

ServicePointManager isn’t defined in PCL but defined in platform specific classes. There are ServicePointManager in both Xamarin.iOS and Xamarin.Android with same usage. You can reference it inside any classes in your platform projects. However, currently there is no such class and seems no way to do so for Windows Phone app. Example: // Xamarin.Android public … Read more

Monotouch/WCF: How to consume the wcf service without svcutil

ChannelFactory<T> has a virtual method CreateChannel(). If this is not overridden, it uses dynamic code generation, which fails on MonoTouch. The solution is to override it and provide your own compile-time implementation. Below is an old service implementation of mine that at least used to work on MonoTouch. I split it up into 2 partial … Read more

Xamarin.Forms: Forms.Context is obsolete

I was having the same issue with several Dependency Services The simplest solution In a lot of cases for Single Activity Applications Xamarin.Forms.Forms.Context Can be replaced with Android.App.Application.Context The Background in more detail Android.App.Application.Context returns the global Application Context of the current process tied to the lifecycle of the Application, as apposed to an Activity … Read more

How to log in to Facebook in Xamarin.Forms

UPDATE (10/24/17): While this way of doing things was okay a few years ago, I now strongly advocate for using native UI for doing authentication, as opposed to the webview method shown here. Auth0 is a great way to accomplish native UI login for your apps, using a wide variety of identity providers: https://auth0.com/docs/quickstart/native/xamarin EDIT: … Read more

JsonConvert.SerializeObject always return {} in XamarinForms

This is a known problem see https://developer.xamarin.com/guides/cross-platform/live/limitations/ Limited support for reflection (currently affects some popular NuGets, like SQLite and Json.NET). Other NuGets are still supported. If you compile it to an APK it works fine on the actual device. Also posted an issue here: https://github.com/JamesNK/Newtonsoft.Json/issues/1578

What is the difference between Xamarin.Forms and Xamarin Native? [closed]

Xamarin.Forms Pros Create one UI for all platforms Use basic components that are available on all platforms (like Buttons, Textfields, Spinners etc.) No need to learn all the native UI frameworks Fast cross platform development process Custom native renderers give you the ability to adjust the appearance and feeling of controls Cons It’s still a … Read more