Book Image

Android 6 Essentials

By : Yossi Elkrief
Book Image

Android 6 Essentials

By: Yossi Elkrief

Overview of this book

Android 6 is the latest and greatest version of the Android operating system, and comes packed with cutting edge new features for you to harness for the benefit of building better applications. This step-by-step guide will take you through the basics of the Android Marshmallow permissions model and beyond into other crucial areas such as the Audio,Video,Camera API and Android’s at work features. Learn how to create, deploy, and manage Android applications with Marshmallow’s API and the latest functionalities. The combination of instructions and real-world examples will make your application deployment and testing a breeze.
Table of Contents (16 chapters)
Android 6 Essentials
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface
Index

Credentials' Grace Period


Ever got the itch when you wanted to use an app after device unlock only to find that you need to log in again or enter the app password again? Well, now we can query the device and check whether it was unlocked recently and how recent was it. This will give our users a chance to avoid all the fuss that comes with using our app. Note that this must be used in conjunction with a public or secret key implementation for user authentication. If you want to read more about the Android Keystore System, head to https://developer.android.com/training/articles/keystore.html.

We use KeyguardManager and check whether our lock screen is secured via the isKeyguardSecure() method. Once we know that it's secured, we can try and use the feature; otherwise, it'd imply that the user didn't set a secure lock screen and this feature is a no-op.

We generate a symmetric key with KeyGenerator in Android KeyStore, which can only be used after the user has authenticated with device credentials...