-
-
Notifications
You must be signed in to change notification settings - Fork 87
CrossPermissions.Current.RequestPermissionsAsync always returns PermissionStatus.Unknown. #39
Comments
When I check in the code permissionStatus.Unknown is returned in the below scenario. Do I need to do anything in my application for this ? Debug.WriteLine("Unable to detect current Activity or App Context. Please ensure Plugin.CurrentActivity is installed in your Android project and your Application class is registering with Application.IActivityLifecycleCallbacks.") |
Did you do this: https://github.com/jamesmontemagno/PermissionsPlugin#android-specific-in-your-baseactivity-or-mainactivity-for-xamarinforms-add-this-code When you install this plugin it will also install a file called "MainApplication.cs" into your Android app and that needs to be there. |
It is now working. Application.cs class is missing from my project. Thankyou James for the reply |
I had the exact same problem(status=unknown). but no application.cs was added nor a mainapplication.cs when i updated the Mediaplugin and installed PermissionsPlugin. Now the status=unkwown no longer waits but the code still has problems.namely the Did I do the correct corrections?Do you have any idea why the takephotasync command is skipped? Thnx in advance, |
Thanks @savvaskef |
CrossPermissions.Current.RequestPermissionsAsync always returns PermissionStatus.Unknown.
Bug
Version Number of Plugin: 1.2.1
Device Tested On: Android 6.0 OS
Simulator Tested On:
Expected Behavior
CrossPermissions.Current.RequestPermissionsAsync should return the status as PermissionStatus.Granted.
Actual Behavior
CrossPermissions.Current.RequestPermissionsAsync always returns PermissionStatus.Unknown.
Steps to reproduce the Behavior
Request the permission using the below statement in dependency service in android project.
var results = await CrossPermissions.Current.RequestPermissionsAsync(new[] { Permission.Camera, Permission.Storage });
cameraStatus = results[Permission.Camera]; //CameraStatus is always returned as PermissionStatus.Unknown
I am using the plugin.currentactivity in android project.
Note: I am writing the above code in custom control and using it later in the actual application.
The text was updated successfully, but these errors were encountered: