Posted by Hoi Lam, Developer Advocate
Rushing onto a train, entering a concert, or simply ordering a coffee, we have all seen users (or ourselves) rummaging through their wallets or mobile app trying to get the right boarding pass, ticket or loyalty card. With Android Wear and a few lines of code in your mobile app, this can all work like magic.
While QR Code images could be attached to a notification since the first release of the Android Wear platform, developers have asked about two situations which they would like to see improve:
With the latest support library, we have added two additional methods to WearableExtender to give developers more control over how background images are displayed in notifications. These new APIs can be used in a number of scenarios, we will focus on the QR code use case in this post:
WearableExtender
setHintAvoidBackgroundClipping(true)
setHintAvoidBackgroundClipping (false)// this is the Default
setHintAvoidBackgroundClipping (true)
setHintScreenTimeout(timeInMS)
We have experimented with a number of customization options with QR codes and here are some of the lessons learnt:
Using QR codes on Android Wear is a very delightful experience. The information that the user needs is right on their wrist at the right time in the right place. With the new APIs, you can now unlock more doors than ever before and give users an easier time with check in on the go.
Sample code can be downloaded from this repository.