How to view PDF file using Xamarin Forms

Android: public void OpenPdf(string filePath) { Android.Net.Uri uri = Android.Net.Uri.Parse(“file:///” + filePath); Intent intent = new Intent(Intent.ActionView); intent.SetDataAndType(uri, “application/pdf”); intent.SetFlags(ActivityFlags.ClearWhenTaskReset | ActivityFlags.NewTask); try { Xamarin.Forms.Forms.Context.StartActivity(intent); } catch (Exception) { Toast.MakeText(Xamarin.Forms.Forms.Context, “No Application Available to View PDF”, ToastLength.Short).Show(); } } iOS, a bit more complex and requiries some extra classes: public void OpenPDF(string filePath) { FileInfo … 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: EDIT: … Read more

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

Access the Android Special Folder Path by using Environment

You are looking for the root of GetExternalFilesDir, just pass a null: Example: var externalAppPathNoSec = GetExternalFilesDir(string.Empty).Path; Note: This is a Context-based instance method, you can access it via the Android application context, an Activity, etc… (see the link below to the Android Context docs) Shared storage may not always be available, since removable media … Read more

Xamarin.Android Proguard – Unsupported class version number 52.0

You need to update the default Android SDK proguard.jar with the latest version of Proguard found here: I would recommend that you install this on the side of the default version that Android ships in android-sdk\tools\proguard. Simply rename the existing folder to something else and add the new version of proguard. This is listed … Read more

Hamburger Menu Xamarin Forms (MasterDetailPage)

Creating the master-detail page: Add a content page and change the code as follows : RootPage.xaml <?xml version=”1.0″ encoding=”utf-8″?> <MasterDetailPage xmlns=”” xmlns:x=”” xmlns:local=”clr-namespace: your_NameSpace” x:Class=”your_NameSpace.RootPage”> </MasterDetailPage> RootPage.xaml.cs [XamlCompilation(XamlCompilationOptions.Compile)] public partial class RootPage : MasterDetailPage { public RootPage() { InitializeComponent(); } } Creating its Menu Page: Add another content page and change the code as follows … Read more