Reputation: 859
<permission
android:name="com.example.myPermission"
android:protectionLevel="normal" />
If I defined a permission like this and use this permission to an activity A. Then I want to check if an app have this permission, so I use PackageManger
and the checkPermission(permissionString, packageName)
method to check. The problem is I don't want to use straight string for permissionName
, is there any way I can get the permission string like Manifest.permission.xxxx
?
Thanks in advance!!
Upvotes: 0
Views: 667
Reputation: 1006574
Well, there is no Manifest.permission
value for your custom permission, because Manifest.permission
is part of the platform, and ~1.5 billion Android devices do not know about your app.
You can try using a string resource for the permission name, referring to that resource both from <permission>
and from your Java code.
Upvotes: 2