Android Studio – remove Security Exception warning

You are looking for (updated to improve clarity): @Override @SuppressWarnings({“MissingPermission”}) public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (LOCATION_REQUEST_CODE == requestCode) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { lastLocation = LocationServices.FusedLocationApi.getLastLocation(googleApiClient); } } EDITED: The correct lint rule is MissingPermission, but there seems to be a bug that … Read more

How to check the multiple permission at single request in Android M?

You can ask multiple permissions (from different groups) in a single request. For that, you need to add all the permissions to the string array that you supply as the first parameter to the requestPermissions API like this: requestPermissions(new String[]{ Manifest.permission.READ_CONTACTS, Manifest.permission.ACCESS_FINE_LOCATION}, ASK_MULTIPLE_PERMISSION_REQUEST_CODE); On doing this, you will see the permission popup as a stack … Read more