locked
Asking for Camera Permissions in Xamarin.Forms for Android 6+ RRS feed

  • Question

  • User274834 posted

    What is the correct way to Request App Permissions at Runtime using Xamarin.Forms layer only, without(!) touching the native Droid layer (MainActivity, IOnRequestPermissionsResultCallback, etc). I'm familiar with the Android native part (requestPermissions(), onRequestPermissionsResult (...)), but I would like to use only the Xamarin.Forms layer.

    Is there a generic solution in Xamarin.Forms for Asking Permissions which works on Android and iOS?

    I can't find any documentation regarding this topic. Also, there are no examples. I have already checked the xamarin-forms-samples repos on github, especially the solution CustomRenderers with CameraPageRenderer.cs (sorry, not allowed to post links yet). But unfortunately this example app does not cover this topic.

    Thanks!

    Wednesday, May 9, 2018 5:31 PM

All replies

  • User53115 posted

    https://www.nuget.org/packages/Plugin.Permissions/

    Wednesday, May 9, 2018 6:12 PM
  • User274834 posted

    Thanks @JoeManke. But this is not what I'm looking for. Because to be able to use the Plugin.Permissions you have to modify the MainActivity.cs class in Droid project (=> native layer).

    I'm asking for something where you don't have to touch the native layer (Droid and iOS projects), but just work on Xamarin.Forms layer.

    Friday, May 11, 2018 9:32 AM
  • User76049 posted

    @ef42 said: Thanks @JoeManke. But this is not what I'm looking for. Because to be able to use the Plugin.Permissions you have to modify the MainActivity.cs class in Droid project (=> native layer).

    I'm asking for something where you don't have to touch the native layer (Droid and iOS projects), but just work on Xamarin.Forms layer.

    That's platform specific functionality, you can't achieve it in the Forms layer, each platform has it's own permissions implementation.

    Friday, May 11, 2018 10:59 AM