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

Bluetooth API Changes


Besides the changes mentioned previously, Android Marshmallow 6.0 has introduced a few more changes to the Bluetooth API.

Bluetooth stylus support

Stylus has been here a for a while; Bluetooth stylus didn't have full support for specifications in versions before Android Marshmallow. You can pair and connect a compatible Bluetooth stylus with either a phone or a tablet. Because you are not bound just to touches on screen, you can fuse the position, pressure, and button state data, allowing more precise user input and experience. Your app can add a listener to the stylus buttons and act accordingly. Just use the View.OnContextClickListener and GestureDetector.OnContextClickListener objects in your activity.

In order to detect stylus button interactions and movement, you need the following:

  • The MotionEvent methods

  • The getTooltype() method, which returns TOOL_TYPE_STYLUS if a stylus with a button is touched on the screen

  • The getButtonState() method, which returns (on Android...