Home > database >  How can i reset my autorization every time i relaunch the app Android
How can i reset my autorization every time i relaunch the app Android

Time:04-13

I want to know how i can reset my autorisation every time a user relaunch the app if it's possible because i have a module who need for every launch of the app my permission needs to be empty.

CodePudding user response:

I'm not sure but, maybe you can use the lifecycle of the activity, request auth everytime activity changes to onPause onResume etc.

CodePudding user response:

In onDestroy() method of parent activity, clear your auth, and in onStart() method of activity check whether the auth is empty/cleared, and if it is empty ask user to re-authorize.

CodePudding user response:

If you also want to clear all the data of the app, use this line inside onDestroy() of the activity:

override fun onDestroy() {
        super.onDestroy()
        (getSystemService(ACTIVITY_SERVICE) as ActivityManager).clearApplicationUserData()
    }

And when user opens the app again, everything will be fresh, all allowed permissions will be revoked and all data will be cleared

  • Related