Android Wear and QR code

Source: Internet
Author: User

This is an article published in the official Android Developer Community Blog, at the beginning of 15, saw this article, until now only time to translate it down.

This is an article on how to correctly display the QR code on Android Wear, there are a lot of experience and lessons to remember, the original address click here.

The original translated content is as follows:

Android Wear and QR code: ways to use the user through Fast track

In a hurry to get on a train, go to a concert or simply order a coffee, we've all seen users or we're looking for a wallet or mobile app to find the right boarding pass, ticket or membership card. With a few lines of code on Android Wear and mobile apps, this will work magically.

new features of the Android support library

Since the first release of the Android Wear platform (when a QR code image can be added to the notification ), the developers have asked them to see two scenarios for improvement:

    • Circular display, it is difficult for developers to understand whether the QR code is complete and is not clipped to show.
    • to protect the battery, Android Wear the screen is not active 5 seconds to close. However, it is difficult for users to guarantee that the QR code will still be displayed on the wrist when they reach the front of the team.

In the latest payment library, we added two additional methods to the Wearableextender, giving developers more permissions to control how the background image is displayed in the notification. These new APIs can be used in a large number of scenarios, we only focus on the use of QR code examples:

    • Make sure the picture is not clipped: sethintavoidbackgroundclipping (true)

With this new approach, developers can ensure that the full QR code is always visible.

Wrong:
Sethintavoidbackgroundclipping (False)
This is the Default

Right:
Sethintavoidbackgroundclipping (True)

    • Ensure that the QR code remains displayed when the user arrives in front of the team: Sethintscreentimeout (TIMEINMS)

This new approach allows developers to set timeouts to meet their special use cases.

Best Design practices

We experimented with a lot of QR code customization options, and here are some lessons we learned:

Be sure to do

    • Be sure to test with your equipment, before deploying, using your barcode reader to ensure that the QR code displayed on the wearable device is functioning properly on your rig.
    • Be sure to use the two-dimensional QR code, which will guarantee maximum matching, and it is easier to read the information to the code reader.
    • Be sure to show only the core information in the text notification, and remember that "less is more". For wearable devices, it is important to be able to navigate.
    • Be sure to test on both round and square tables, and the amount of text that can be displayed on the notification depends in particular on the shape factor (square and circle).
    • Be sure to have the branding icon, in the main notification of theAndroid Wear Stream, that the developer can identify the notification by using Setlargeicon to set the color icon.
    • Be sure to use the background to pass extra information, in order to get better results, Consider setting sensitive backgrounds through setbackground, such as pictures or photos of train destinations or stadiums.
    • Be sure to use 400x400 or a larger resolution of the QR code, according to other background images, QR code image recommended minimum pixels is 400x400.

Must not do

  • must not promote QR code, android wear
  • do not use any color other than gray or default theme colors on the text of the notification, although android wear notice payment of basic text formatting operations, such as setting the text color, which should be used when modifying the color set to default or Gray. The reason is android 4.x holo wear android 5.0+ bold and italic is a good format choice.

Android Wear was born for the busy people .

Using the QR code on Android Wear is a very enjoyable experience. The information the user needs is right in the right place on the wrist. With the new API, you can now open more doors than before and be able to give busy people more time to see.

Sample code Download from here

Android Wear and QR code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.