Reputation: 23
for example,my app requests a permission in Manifest file,like android.permission.WRITE_EXTERNAL_STORAGE,how can i check whether the permission is denied by user or some security apps?
Upvotes: 1
Views: 4035
Reputation: 21
Call context.checkCallingPermission(permission)
permission -- The name of the permission being checked, as a String
Returns PERMISSION_GRANTED if you have the permission, or PERMISSION_DENIED if not.
As noted in the docs and the comments, there are some subtleties here.
Upvotes: 2
Reputation: 1
You can use checkCallingPermission() to check weather the runningtime permission is denied by users or some apps.
Upvotes: 0
Reputation: 1600
Right now, android asks for the user to accept all the permissions an app asks for in the manifest on installation. In the upcoming M release, android will switch over to the iOS style of permissions with an "on needed" basis. (For certain permissions. See @Commonsware's comment for more details) Meaning whenever the user tries to use a feature that requires permission it will ask them to accept or deny. If they hit deny I imagine there will be an sdk positive and negative response button interface to implement.
As for right now in your dilemma, if the user rejects permissions they won't be able to use your app period.
Upvotes: 0