Incorrect permission status on Android For Xamarin Forms

dharam_devdharam_dev USMember ✭✭

The plugin returns Denied on Android when you haven't even asked the user for the permission. The same situation on iOS returns Unknown, which makes more sense.

var status = await CrossPermissions.Current.CheckPermissionStatusAsync(permissions);

here status is Denied in Android in initial state while in iOS it return Unknown

Best Answer

Answers

  • SHUBHAMSHARMA_2927SHUBHAMSHARMA_2927 USMember ✭✭✭

    @dharam_dev

    these permission are correct and you can use following code for also find status for ios:
    var newStatus = await CrossPermissions.Current.RequestPermissionsAsync(Permission.Location);
    after this you get a popup and then you can find the status easily :)

  • dharam_devdharam_dev USMember ✭✭

    @SHUBHAMSHARMA_2927 Thanks For Reply,

    but i'm asking about inital situation where you never ask to user for permission and just check the status for particular permission i.e. Location,Storage,Phone, this status is show Denied in only Android Platform while instead of Unknown , it's working fine in iOS.

    any advice and suggestions will be greatly appreciated

    Thanks in Advance :smile:

  • SHUBHAMSHARMA_2927SHUBHAMSHARMA_2927 USMember ✭✭✭

    @dharam_dev

    May be i am not sure but when i have install an app which want these type of permission and in my phone then i come on this result that droid platform is autometically set status to denied mode beacouse the feature which want that permission and system information about that app are react like they are denied....

  • JoeMankeJoeManke USMember ✭✭✭✭✭

    On Android, the only way you get a status of Unknown is if you call CheckPermissionStatusAsync for a permission that is not in your manifest, or you do not have the CurrentActivity plugin properly configured. There is no concept of "not having asked yet" on Android, it's either Granted or Denied.

    https://github.com/jamesmontemagno/PermissionsPlugin/blob/master/src/Plugin.Permissions/Permissions.android.cs

  • dharam_devdharam_dev USMember ✭✭
    Accepted Answer

    @SHUBHAMSHARMA_2927 @JoeMake
    Thanks for Reply

    Now, I Handled Permissions in different way for Android in my Forms Projects.
    Thanks Again :)

Sign In or Register to comment.