How to force permission “android.permission.CAMERA” to be added to manifest in Codename one

后端 未结 2 478
孤独总比滥情好
孤独总比滥情好 2021-01-03 07:53

I am trying to show a live preview of the rear facing camera in Codename One. I use for that the native interface (I am targetting Android first).

To allow my app t

相关标签:
2条回答
  • 2021-01-03 08:14

    In the past, you add the permission you want to your manifest and then it is requested when your user attempts to install your app. As of Android 6.0+, this has changed. Now you can just request a permission when your app needs it for the first time. After the user grants you permission, you don't need to ask again next time. Some benefits of this include keeping your user aware of why you need specific permissions and not requesting permissions that you don't actually need.

    You can read more about how to implement it here: https://developer.android.com/training/permissions/requesting.html

    There is no way to use a phones camera without asking for permission at some point.

    0 讨论(0)
  • 2021-01-03 08:26

    You need to add the following build hint:

    android.xpermissions=<uses-permission android:name="android.permission.CAMERA" android:required="false"/>
    

    You can also add this to the cn1lib so it is injected automatically.

    0 讨论(0)
提交回复
热议问题