Android 6.0 multiple permissions

Just include all 4 permissions in the ActivityCompat.requestPermissions(…) call and Android will automatically page them together like you mentioned. I have a helper method to check multiple permissions and see if any of them are not granted. public static boolean hasPermissions(Context context, String… permissions) { if (context != null && permissions != null) { for … Read more

Android marshmallow request permission?

Open a Dialog using the code below: ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 1); Get the Activity result as below: @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case 1: { // If request is cancelled, the result arrays are empty. if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // permission was … Read more

Permission Denial: startForeground requires android.permission.FOREGROUND_SERVICE

This will happen if you have set targetSdkVersion = 28 (Android 9 / Pie) or above and have not declared the usage of the FOREGROUND_SERVICE permission. From the migration notes for Android 9: Apps wanting to use foreground services must now request the FOREGROUND_SERVICE permission first. This is a normal permission, so the system automatically … Read more

Android M Permissions: onRequestPermissionsResult() not being called

I ran into the same issue and I just found the solution. When using the Support library, you have to use the correct method calls. For example: When in AppCompatActivity, you should use ActivityCompat.requestPermissions; When in android.support.v4.app.Fragment, you should use simply requestPermissions (this is an instance method of android.support.v4.app.Fragment) If you call ActivityCompat.requestPermissions in a … Read more

Android M – check runtime permission – how to determine if the user checked “Never ask again”?

Developer Preview 2 brings some changes to how permissions are requested by the app (see also http://developer.android.com/preview/support.html#preview2-notes). The first dialog now looks like this: There’s no “Never show again” check-box (unlike developer preview 1). If the user denies the permission and if the permission is essential for the app it could present another dialog to … Read more

Exception ‘open failed: EACCES (Permission denied)’ on Android

Google has a new feature on Android Q: filtered view for external storage. A quick fix for that is to add this code in the AndroidManifest.xml file: <manifest … > <!– This attribute is “false” by default on apps targeting Android Q. –> <application android:requestLegacyExternalStorage=”true” … > … </application> </manifest> You can read more about … Read more

How can I programmatically open the permission screen for a specific app on Android 6.0 (Marshmallow)?

According to the official Marshmallow permissions video (at the 4m 43s mark), you must open the application Settings page instead (from there it is one click to the Permissions page). To open the settings page, you would do Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts(“package”, getPackageName(), null); intent.setData(uri); startActivity(intent);