Reputation: 569
I am new to android development. I have written a loop which go thru all installed applications. And it lists out permissions that are used by each applications. Now I am trying to allow user to disable or enable permission. For example if an App uses SEND_SMS, then user should be able to disable that permission for that application. And if user should be able to enable back if s/he want it back. Can some body provide me idea on how to deal with this?
Upvotes: 2
Views: 2303
Reputation: 54672
There is no way to add or remove permission dynamically at run time. You must declare them at the manifest.
Perhaps you can do one thing. You can just get user's wish to enable disable a feature and handle it by your own. I dont see any need of chaning permission dynamically for this case. Say if user disable sms sending from settings then just dont send sms from your application. Why do you need the change the permission for this?
Another example. Say you need to receive a broadcast which needs a permission. So disable the broadcastreceiver just unregister the receiver.
So in all cases you can disable or enable your features. So the main issue is to enable/disable feature not enabling/disabling permission
Upvotes: 3