o7planning

How to disable the permissions already granted to the Android application?

View more Tutorials:

1- Question

I put out a situation, you create an Android application, such a small application used Camera to record video. With Android API <23, you must grant permissions to use the Camera in AndroidManifest.xml.
<uses-permission android:name="android.permission.CAMERA" />
With Android API> = 23,  you need to ask the user by using the code:
public static final int REQUEST_CAMERA_PERMISSION= 100;

// .....

private void askCameraPermission()   {

   if (android.os.Build.VERSION.SDK_INT >= 23) {


       int cameraPermission = this.checkSelfPermission(Manifest.permission.CAMERA);
       if (cameraPermission != PackageManager.PERMISSION_GRANTED  ) {


           this.requestPermissions(
                   new String[]{Manifest.permission.CAMERA },
                   REQUEST_CAMERA_PERMISSION
           );
       }
   }  
}
For the first time, users use the application (with Android API > = 23), a dialog will show up to ask the user for permission, as illustrated below:
When a user has granted the permissions that the application requires the use of application in previous time, it will not display dialog to ask the user for using the app in the next time.

However, if you are being programmed applications, sometimes you need to remove the permissions that had previously allowed to retest your application, to make sure everything is perfect.

2- Android Emulator 30.x

On the Android Emulator, follow the steps as shown below to access Settings.
Click on "Apps & notifications".
Choose an app you are interested in:
You can now see all the permissions you have granted, and the permissions you have denied the application.
Note: You can also uninstall the application, all permissions will be removed.

3- Android Emulator (OLD)

Click Settings:
Click Apps:
Choose your application:
Click Permissions:
Remove the permissions granted to the application:
Rerun your application, the dialog will show up asking the user for permissions.

View more Tutorials:

Maybe you are interested

These are online courses outside the o7planning website that we introduced, which may include free or discounted courses.