Acquire “signature” permissionlevel on Android

隐身守侯 提交于 2019-12-07 21:01:49

问题


I'm building an Android app, and one of the permission I need is defined as:

android:protectionLevel="signature|system|development"

How do I get the signature protection level? Do I need to sign my application somehow?

Do I need to sign it with OEM ? (Samsung\HTC\LG)?


回答1:


signature means that to be able to get access to the resource, your app have to be signed with the same certificate that the holder of the permission. If this is not your app you are trying to connect to, then you basically are out of luck. If that's system one then you are out of luck even more, This is documented here:

"signature"

A permission that the system grants only if the requesting application is signed with the same certificate as the application that declared the permission. If the certificates match, the system automatically grants the permission without notifying the user or asking for the user's explicit approval.

EDIT

Im trying to read logcat file through my application. this requires the permission android.permission.READ_LOGS

You cannot access logs on stock ROM that are not created by your application. That's introduced for security reasons, so would not make sense to let you get it just because you need it. If you build own ROM, then you can have it, but then you should know this already.



来源:https://stackoverflow.com/questions/18297986/acquire-signature-permissionlevel-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!