Introducing Android 6 Marshmallow
One of the main changes in this version has to do with the permissions for apps. Before Android M, we were used to accepting the permissions of an app when we were about to download it; the play store showed us a list of permissions that an app has, and we needed to accept them in order to download and install it.
Runtime permissions
This has changed with the introduction of runtime permissions. The idea here is to accept the permission only when you need it. For instance, WhatsApp might not need access to your microphone until your make a call or leave a voice message.
This is something we need to take into account when we develop an app; it is a change for the developer who now needs to control what is to be done if the user doesn't accept the permission. Previously, we didn't have to do any controlling because it was an all-or-none choice at installation time; now, we have to consider the decision of the user at runtime.
Tip
Downloading the example code
You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Power-saving optimizations
There is another improvement regarding the battery life of our phones since Lollipop; this time, Google has introduced two new states: doze mode and app standby.
Doze mode improves the sleep efficiency of idle devices. If we turn off the screen and are not using the phone, we enter the idle state. Previously, applications could do network operations and continue working in the background; now, with the introduction of doze mode, the system periodically allows our apps to work in the background and perform other pending operations for a brief period of time. Again, this brings in some consideration while developing; for instance, in this mode, our apps can't access the network.
App standby is an induced idle mode for an app that has not been used for a while and doesn't have any processes running in the background. It is used for an app if it does not show any notifications and if the user has not explicitly asked it to be exempt from optimization. This idle mode prevents the app from accessing the network and executing pending jobs. When the power cable is connected, all apps in a standby state are released, and the idle restrictions are removed.
Text selection
In the previous versions, when a user selected text, a set of actions appeared on the action bar, such as copy, cut, and paste. With this version, we can show these actions and more, in a floating bar that will be presented above the selection:
Fingerprint authentication
In this version of Android, we can authenticate the use of our fingerprint. The authentication can be at a device level to unlock the phone, not just to unlock a specific app; so, we can authenticate users in our app based on how recently they unlocked their device.
We have a new object available, FingerprintManager
, which will be in charge of the authentication and allow us to show a dialog requesting the fingerprint. We would need a device with a fingerprint sensor in order to use this feature.
Direct share
Direct share is a new addition to simplify the content sharing process. Previously, if we were in the gallery and wanted to share a picture to a contact in WhatsApp, we had to click on Share, find WhatsApp in the list of apps, and then find a contact inside WhatsApp to share this content. This process will be simplified, showing a list of contacts with whom you can share the information directly:
These are the main new features that have been released with Android 6 Marshmallow; the complete list can be seen at http://developer.android.com/preview/index.html.