Karumi / Dexter

Android library that simplifies the process of requesting permissions at runtime.
http://karumi.com
Apache License 2.0
5.23k stars 672 forks source link

Check for permission without actually ask for it using Dexter #189

Open romshiri opened 7 years ago

romshiri commented 7 years ago

Hi guys,

Is there any way to check for permissions without actually showing a dialog using the library? I know I can do that with the framework library but as the code in Dexter is much cleaner so I prefer to use that.

I couldn't find in the documentation something that points to that.

Thanks.

Serchinastico commented 7 years ago

Hi @romshiri

The dialog is not part of Dexter but the Android system, there is no way you can get rid of it, even if you don't use Dexter. However, if you are talking about the rationale dialog, that's an optional implementation we provide but you can always use the BasePermissionListener implementation.

erawhctim commented 6 years ago

@romshiri I was wondering the same thing. From what I can tell, Dexter doesn't have a method to do this, I would guess because the actual platform API call call is simple enough that there's no need to make a dexter wrapper around it. I'd just stick with that:

val calendarPermissionGranted = ContextCompat.checkSelfPermission(thisActivity, Manifest.permission.WRITE_CALENDAR) == PackageManager.PERMISSION_GRANTED