Search code examples
androidandroid-activityandroid-permissions

Where should I re-check for Android permissions?


Since Android Marshmallow(API 23) an app must ask for permissions at runtime and the user can revoke permissions at any time, so if an app is running and the user goes to system settings and revokes some permissions the app uses then he returns to the app, the app itself has to re-check if permissions are still available. My question is: where is the best place to do this check, is onRestart() a good choice or maybe it is possible for the user to revoke permissions without triggering the onStop() method thus requiring the check to be made in onResume()?


Solution

  • At first check the permission onCreate() and then check the permission onResume() for best practice. Or otherwise check it onRestart()