1

I am trying to reset the android permissions defined by the user through a java program.

this is the part of android.webkit API and i found out on- GeolocationPermissions.Callback

Although there are a lot of android permissions that user may define in AndroidManifest.xml.So how do i reset all the permissions of android device in Java ? Is there any common way to do that?

Thanks in Advance.

keystrokker
  • 73
  • 1
  • 6
  • 14
  • Where did you see the code to reset the geolocation programmatically? You are just referencing to the callback, but that is not how to reset the permissions. That's just the code that gets called when the permission prompt (screen) got shown. I don't think it's possible without showing any kind of UI to the user, but I might be wrong. Maybe this is helpful: http://stackoverflow.com/questions/32822101/how-to-programmatically-open-the-permission-screen-for-a-specific-app-on-android – Mathias Conradt Nov 22 '16 at 16:05

2 Answers2

0

In short, I don't think this is possible.

From what I have understood, you are referring to the new permission model (Runtime Permissions) introduced in Marshmallow and by "reset" you want user to grant it to you.

Runtime Permissions is a step to give users full control over the permissions used by the apps. Apps can only request for the permissions but cannot change it programmatically without any user interaction.

The solution here is to ask for the permission and check if user has granted it or not. If not, explain him about why you need that specific permission.

For more read:

(Correct me if I'm wrong / misunderstood the question. You can edit the question with more details.)

Mangesh
  • 5,491
  • 5
  • 48
  • 71
0

There's this API

((ActivityManager)context.getSystemService(ACTIVITY_SERVICE)).clearApplicationUserData();

Permits an application to erase its own data from disk. This is equivalent to the user choosing to clear the app's data from within the device settings UI. It erases all dynamic data associated with the app -- its private data and data in its private area on external storage -- but does not remove the installed application itself, nor any OBB files. It also revokes all runtime permissions that the app has acquired, clears all notifications and removes all Uri grants related to this application.

However, this api will force close your app. More info in this answer: https://stackoverflow.com/a/29197259/5673746

mco
  • 1,809
  • 15
  • 31