Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

How to check Location App Permissions in Xamarin Android Marshmallow?

$
0
0

We can create Dependency service to check weather Location service is enabled or not in the device.
But in Application Manager User can disable App Permission(Location).
Identified that we can check app permissions from Marshmallow.

Could you please tell me what is the way, i have tried below solutions but it is not working as expected.

Method1:
PackageManager pm = Forms.Context.PackageManager;
Permission permission = pm.CheckPermission(Manifest.Permission.AccessFineLocation, Forms.Context.PackageName);

Method2:
Permission permission = ContextCompat.CheckSelfPermission(Forms.Context, Manifest.Permission.AccessFineLocation);

Method3:
bool perm2 = pm.IsPermissionRevokedByPolicy(Manifest.Permission.AccessFineLocation, Forms.Context.PackageName);

But No luck. Please let me know solution.


Viewing all articles
Browse latest Browse all 77050

Trending Articles