Created
July 7, 2015 08:20
-
-
Save hitherejoe/4353a016c4c05df2c5b1 to your computer and use it in GitHub Desktop.
Andriod M - Request single permission
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
private static final int REQUEST_LOCATION = 1503; | |
private void requestSinglePermission() { | |
String locationPermission = Manifest.permission.ACCESS_FINE_LOCATION; | |
int hasPermission = checkSelfPermission(locationPermission); | |
String[] permissions = new String[] { locationPermission }; | |
if (hasPermission != PackageManager.PERMISSION_GRANTED) { | |
requestPermissions(permissions, REQUEST_LOCATION); | |
} else { | |
// Phew - we already have permission! | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment