unity-android 的權限

https://docs.unity3d.com/Manual/android-manifest.html  

Unity會自動添加的權限當調用某些特定的Unity api:

Permissions

Unity automatically adds the necessary permissions to the manifest based on the Android Player Settings and Unity APIs that your app calls from the script. For example:

For more information about permissions, see Android developer documentation on Android Manifest Permissions.

If your plug-ins require a permission by declaring it in their manifests, Unity automatically adds the permission to the resulting Android manifest during the merge stage. All Unity APIs that plug-ins call also contribute to the permissions list.

項目中有過一個ACCESS_FINE_LOCATION 的權限,原因是項目中用了tolua,反射了 UnityEngine.Input 類,其中有個成員是 location,類型是 LocationService。雖然反射了但是項目中也沒有用這個接口,所以就單獨排除了 location成員的反射。

Runtime permissions in Android 6.0 (Marshmallow)

動態權限,app運行的時候彈出給用戶選擇是同意某些權限,而不是安裝的時候就同意。

可以在一開始遊戲的時候就彈出所有的權限讓用戶選擇,也可以直接在用到這個功能的時候彈出來讓用戶選擇。如果使用需要權限的功能之前不做判斷是否同意,比如當時是禁止的使用的狀態,app就會崩潰。

所有的權限都是要申明在 androidmanifest.xml中的

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章