16 February 2016
Introducing new Android 6 features
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
- 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.
Scott Harrison
Posted at 18:56h, 16 FebruaryGoogle play games save?
Ian
Posted at 04:01h, 17 FebruaryGreat news. I assume this will mean Android builds are now API 23? That should make Google Play a lot happier when speaking to them.
Alexander McCaleb
Posted at 17:16h, 24 FebruaryYes, Android builds now target API Level 23. Because of this, there may be significant behavior changes in your app if you build it with this version or the new public release, 2016.2830.
Simon
Posted at 00:55h, 19 FebruarySo…can we still have SOME permissions in our build.settings files? Or do we have to go all on-demand or keep everything in build.settings? For example, if I have a permission that I want the user to be aware of before downloading, but in the app I want to ask for permissions to use the microphone, is that okay?
Alexander McCaleb
Posted at 17:26h, 24 FebruaryWith this update, there isn’t any change that needs to be made to build.settings. You’ll still include all the permissions your app uses as before.
With an app that targets Android 6, when it’s downloaded from Google Play, it no longer gives a dialog detailing all the permissions the app needs. Instead, users can get all the permission details about your app before downloading it by scrolling to the “Permission details” section on the Google Play page for your app.