Created
September 2, 2021 12:57
-
-
Save fatihkurcenli/f01af9e5e7250729518b112ea36762ba to your computer and use it in GitHub Desktop.
checkPermissions.java
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
//fonksiyonumuzu global yaparak permission code sorarak izin olup olmadigini diger | |
//siniflardan kontrol edebiliriz. | |
public void checkPermissions(String permission, int requestCode) { | |
//Checking if permission granted or not | |
if (ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_DENIED) { | |
//Take permissions | |
ActivityCompat.requestPermissions(MainActivity.this, new String[]{permission}, requestCode); | |
} else { | |
Toast.makeText(this, "Permission already denied", Toast.LENGTH_SHORT).show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment