Search code examples
codenameone

Codename One Turn Android Permissions Auto Detect


The Android Sensitive App Permissions around the Location permissions is causing some issue with our app submissions.

We've have build a Library using CN1 that encapsulates all of the Features we use in our apps, Foreground and Background Location management being one of them.

When we then need to use the Feature, we simply activate it and pass in some variables to do what we want to do.

The problem come when we don't need the Feature. The Auto Detecting of what permissions should be included picks up the usage of the Location classes and always adds the Location Permission.

I've tried adding the following build hints with no luck,

codename1.arg.android.permission.ACCESS_BACKGROUND_LOCATION=false
codename1.arg.android.permission.ACCESS_COARSE_LOCATION=false
codename1.arg.android.permission.ACCESS_FINE_LOCATION=false
codename1.arg.android.permission.ACCESS_MOCK_LOCATION=false

I've also tried codename1.arg.android.removeBasePermissions=true but that just removed the INTENT permission.

Is there any way we can instruct the build server NOT to include certain permissions or turn off the permission auto detection?


Solution

  • There's no such ability since the library is a client side feature. The build process packages the library together with the application as if it was one large jar. Then the server code does the permission analysis process.

    We have no way of knowing that this code arrived from a library. I think the "right thing" would be to split the library based on permissions to smaller libraries and remove the dependency from the code. This is important since if the code would still be there it might fail on iOS builds too and won't pass the appstore review.

    On Android the obfuscation code will probably remove the unused code but this isn't guaranteed.

    Having said that, we'll add a android.blockLocationPermission=true option to the server update tomorrow so you can try that approach. The other options will not be necessary.