Open App Permissions on Android programmatically?

后端 未结 2 1987
情深已故
情深已故 2021-01-21 11:40

I want to show all apps and permissions via list from the system to the user. I know that this setting available for API >= 23 in different locations.

For API >= 26 it i

2条回答
  •  灰色年华
    2021-01-21 12:11

               if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
                    final AlertDialog.Builder adb = new AlertDialog.Builder(this);
                    adb.setTitle("Click on ok then app will redirect to app settings then 
                       please click on Other Permissions and  Please Allow All ");
                    adb.setPositiveButton("ok", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
    
                           Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                            Uri uri = Uri.fromParts("package", getPackageName(), null);
                            intent.setData(uri);
                            startActivity(intent);
                        }
                    });
                    adb.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            finishAffinity();
                            dialogInterface.dismiss();
                        }
                    });
                    adb.show();
                }
    

提交回复
热议问题