Creating always-on wearable apps

The ability to create fully-featured apps for Android wearables is a great way to provide a hands-free experience. However, to preserve battery, Android will quickly put the device to sleep, resulting in the experience being lost.

How to do it...

Sometimes, we want to be able to display content on the screen, even when the wearable goes to sleep or enters the ambient mode:

  1. The first thing that we need to do is add the wake lock permission requirement. We need to add this to both, wearable and handheld, as the wearable cannot have any permission that the handheld does not have:
    [assembly: UsesPermission(Manifest.Permission.WakeLock)]
  2. Next, in the wearable app, we need to specify that we are going to be using the wearable ...

Get Xamarin Mobile Development for Android Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.