Book Image

Android Wear Projects

By : Ashok Kumar S
Book Image

Android Wear Projects

By: Ashok Kumar S

Overview of this book

Android Wear Projects is your opportunity to step into the exciting new world of Android Wear app development. This book will help you to master the skills in Android Wear programming and give you a complete insight on wear app development. You will create five different Android Wear apps just like the most popular Android Wear apps. You will create a To-do list, a city maps app, a Wear messenger, Wear fitness tracker and Watch face. While you create these apps you will learn to create custom notifications, receive voice inputs in notifications, add pages to notifications and stack notifications. You will see how to create custom wear app layouts, the custom UIs specially designed for Wear. You will learn to handle and manage data and syncing data with other devices, create interactive Watch faces and also ensure the safety and security of your Wear apps by testing and securing your apps before you deploy them on the app store.
Table of Contents (18 chapters)
Title Page
About the Author
About the Reviewers
Customer Feedback
Let us Help Capture What is on Your Mind - WearRecyclerView and More
Let us Help Capture What is on Your Mind - Saving Data and Customizing the UI
Measuring Your Wellness and Syncing Collected Sensor Data
Let us Chat in a Smart Way - Notifications and More

The CanvasWatchFaceService.Engine class

The CanvasWatchFaceService.Engine class extends the WatchFaceService.Engine class. Here, actual implementation of a watch face that draws on a canvas can be accomplished. We ought to implement onCreateEngine() to reestablish your concrete engine implementation. CanvasWatchFaceService.Engine has one public constructor with a couple of procedures to us to implement the watch face. How about we examine a couple of methods that we will in the later bit of this chapter:

  • void invalidate (): Plans a call to onDraw(Canvas, Rect) to draw the following frame. This must be approached on the main thread.

  • void onDestroy (): In this callback, we can the hardware and other resources that we would be using to complete the watch face.

  • void onDraw(Canvas canvas, Rect bounds): Draws the face, all the visual components, and clock revive rationale, and other clock arrangements are accomplished in this method.
  • void onSurfaceChanged(): This takes four params, void onSurfaceChanged...