Created
April 5, 2023 08:51
-
-
Save akshaykalola28/99b0f267c54609071518abba5b755840 to your computer and use it in GitHub Desktop.
Check permission in android using extension function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context | |
import android.content.pm.PackageManager | |
import androidx.core.content.ContextCompat | |
fun Context.isPermissionGranted(permission: String) = run { | |
ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment