Created
January 23, 2019 18:42
-
-
Save shishirthedev/3e8ee30865eae92972e4817ad50b923b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| @Override | |
| public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |
| super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |
| switch (requestCode) { | |
| case REQUEST_CAMERA: { | |
| // If request is cancelled, the result arrays are empty. | |
| if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | |
| //Permission was granted. Now you can call your method to open camera, fetch contact or whatever | |
| openCamera(); | |
| } else { | |
| // Permission was denied....... | |
| // You can again ask for permission from here | |
| Toast.makeText(this, "Permission Denied", Toast.LENGTH_SHORT).show(); | |
| } | |
| break; | |
| } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment