Android M adds a long-awaited feature: user-managed permissions. While some Android permissions you request will be granted to you at install time, others will require you to specifically ask the user at runtime. The user can not only reject your request then, but she can change her mind and revoke the permission at any time in the future.
In this code lab, we will walk through how adjust your app to take the runtime permission model into account: when to ask for permission, how to determine if you have permission, how to gracefully degrade when the answer is "no", and so on. Attendees can follow along and modify the same sample project that the presenter will use for demonstrations, or attendees can experiment with their own code. Steps in the code lab will include:
- Converting a traditional Android project to be able to build with the M Developer Preview
- Detecting if you have all of your requested runtime permissions
- Asking the user for those runtime permissions when needed, including explaining why you need them
- Indicating to the user what portions of your UI still need permissions
- Testing relevant scenarios, including handling the user revoking already-granted permissions
If you wish to participate in the hands-on work, you will need a copy of Android Studio and the M Developer Preview (version 2) installed on your notebook. You will also need to be hooked up to the conference WiFi or otherwise have Internet access.
Mark Murphy is the founder of CommonsWare and the author of "The Busy Coder’s Guide to Android Development". He is active in supporting the Android developer community, from answering questions on Stack Overflow to publishing sample code and reusable components as open source.