Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Andriod M - Request single permission
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