天天看點

Android 程式申請權限小知識點

在Google Play 應用商店,顯示至少支援裝置的數量時候會用到權限數量。其他地方用處不大。

Android系統提供為程式提供了權限申請,即在manifest中使用uses-permission來申請即可.實作起來非常簡單,但是有些問題會随之浮出水面. 常見的現象是,有時候新加一個權限,(在Google Play上)程式顯示的支援的裝置會減少.

因為有些權限隐式地需要feature,即當你顯示使用uses-permission,會預設地為程式加入uses-feature. 

而Android以及Google Play判斷是否可以安裝和現實的依據是,裝置包含的system features是否完全包含程式申請的全部features. 隻有在全部滿足了程式需要的feature的裝置上才可以展示并安裝.

我們在程式manifest加入一行申請攝像頭的權限.

Android 程式申請權限小知識點
Android 程式申請權限小知識點
Android 程式申請權限小知識點

<a href="http://developer.android.com/guide/topics/manifest/uses-feature-element.html#permissions" target="_blank">http://developer.android.com/guide/topics/manifest/uses-feature-element.html#permissions</a>

轉自:http://droidyue.com/blog/2014/07/04/attentions-when-adding-permission-for-android-application/

繼續閱讀