I process my application code to work on Marshmallow devices, I control its permissions dialog to display in the necessary places.
This scenario is currently supported where it requires two permissions (Location and storage) , and I want to set one by one how Hangout does it. Could not find how it is configured, any solution?

Here is the code I'm processing for one permission:
case REQUEST_CODE_WRITE_EXTERNAL_STORAGE: { if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { /Permission is granted Toast.makeText(this, "SDK >= 23 & permission Granted ", Toast.LENGTH_SHORT).show(); return true; } else {
And in onRequestPermissionsResult() :
case REQUEST_CODE_WRITE_EXTERNAL_STORAGE: { // If request is cancelled, the result arrays are empty. if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // permission was granted, yay! Do the // contacts-related task you need to do. Log.e("PMS", "granted"); Toast.makeText(this, "SDK >= 23 & permission Granted ", Toast.LENGTH_SHORT).show(); } else { Log.e("PMS", "Not Granted"); // permission denied, boo! Disable the // functionality that depends on this permission. int checkStatus = getPermissionStatus(Manifest.permission.WRITE_EXTERNAL_STORAGE); if (checkStatus == 3) { Toast.makeText(this, "SDK >= 23 & permission Denied ", Toast.LENGTH_SHORT).show(); } else if (checkStatus == 4) { Toast.makeText(this, "SDK >= 23 & permission Blocked ", Toast.LENGTH_SHORT).show(); } } return; }
source share