Corona Labs is pleased to announce initial support for Android 6 “Marshmallow” in daily build 2016.2828 and later. This brings some significant changes and improvements to Android developers.
Overview
Android 6 introduces some pretty fantastic changes. One of the most significant involves “on-demand permissions” which behave more like iOS in that, instead of requesting several permissions from the start, you can defer the request for a permission until you need it.
On the Corona side, some additions and changes for Android 6 include:
- Additions to native.showPopup() to request permissions at appropriate times in your app, along with methods to handle the user’s response to these requests.
- Additions to native.canShowPopup() to check whether you’re on a platform that supports requesting permissions.
- Additions to system.getInfo() related to which permissions have been granted or denied.
- Enhancement of media.hasSource() to check for both the existence of a camera and whether the app has permission to access it.
- Existing Lua APIs that require permissions will now prompt the user. By default, these will behave similar to permission requests on iOS.
Important notes
With any new release, there are some known issues you should be aware of:
- Plugins which use any permissions in Android’s dangerous permissions and permission groups table are at risk of breaking. Plugin developers should test against daily build 2016.2828 or later to see if their plugin may need to updated to support the new permissions framework. We will have more information on the process as we come closer to the next public release.
- Apps using expansion files should have
STORAGE
permissions granted before launching. - The runtime permission model introduces a behavior change to
system.getInfo("deviceID")
(reference) which makes it possible for a user to manipulate the value returned from this API call. Depending on the user’s action, this may negatively impact analytics that an app is collecting which depend on the results of this API being consistent. See the documentation for more details on how to handle this issue. Also note that you’ll have to restart your app to see the related changes.
Feedback and issues
We would like to get your feedback on Android 6 and the new APIs. Let us know of any issues you encounter by filing a bug report. Please remember that a bug report should contain the minimal amount of code (main.lua
) to show the problem, along with config.lua
and build.settings
. If your project requires any artwork or sound, make sure they are also included in the submitted project.