Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to check Location App Permissions in Xamarin Android Marshmallow?

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.

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

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

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

But No luck. Please let me know solution.


Best Answer


Sign In or Register to comment.