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

The Assist API


Back in Google I/O 2015, we saw the Now on Tap feature, where Google Now could peek into a running app and provide contextual assistance. The Assist API offers a new way for users to engage through an assistant. The assistant must be enabled prior to using it, allowing it to be aware of the current context. Triggering the assistant is done by long-pressing the Home button, no matter which app is active.

You can opt out of this by setting the WindowManager.LayoutParams.FLAG_SECURE flag.

Opting in requires you to use the new AssistContent class.

In order for us to be able to feed additional context from our app to the assistant, we need to follow these steps:

  1. Implement the Application.OnProvideAssistDataListener interface, which is called when the user requests assistance.

  2. Register it using Application.registerOnProvideAssistDataListener().

  3. Override the onProvideAssistData() callback, which is called when the user requests assistance. It is used to build an ACTION_ASSIST intent...