0

I want to grant camera permission for the application using my Application class in my Xamarin.Android project. But I cannot call

ActivityCompat.RequestPermissions(this, _mPerms, 1);

within my Application class since this should be an Activity. So how should I call this method?

Randi
  • 639
  • 2
  • 6
  • 23
  • 1
    I believe it is not possible: https://stackoverflow.com/questions/38219056/request-permission-from-application-class Best Krzysztof – Krzysztof Kaźmierczak Feb 19 '20 at 13:04
  • 1
    @Randi If user grants the permission, the **ActivityCompat.RequestPermissions(Activity activity, string[] permissions, int requestCode)** method should be called. But if you call this method in Application class, the activity is null, about grant permission that you can take a look:[Permissions In Xamarin.Android](https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/permissions?tabs=windows) – Cherry Bu - MSFT Feb 20 '20 at 02:22
  • @KrzysztofKaźmierczak, Thanks.. – Randi Feb 21 '20 at 01:23
  • @CherryBu-MSFT Thanks... – Randi Feb 21 '20 at 01:23

0 Answers0