Last active
July 3, 2018 04:34
-
-
Save shikto1/cff61403f092d13cb7349d5786805174 to your computer and use it in GitHub Desktop.
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
@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