Tuesday, 27 January 2015

Android Wear & QR Code: Putting Users through the Fast Track

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.



What’s new in the Android Support Library


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:



  1. With circular displays, it is hard for developer to know if the QR code is displayed in it’s entirety and not cropped.

  2. To conserve battery, Android Wear switches off the screen after five seconds of inactivity. However, this makes it hard for the user to ensure that the QR code is still displayed on their wrist when they reach the front of the queue.


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:



  • Ensure the image is not cropped - setHintAvoidBackgroundClipping(true)

  • With this new method, developers can ensure that the entire QR code is always visible.














    Wrong:
    setHintAvoidBackgroundClipping
    (false)
    // this is the Default
    Right:
    setHintAvoidBackgroundClipping
    (true)




  • Ensure the QR code is still displayed when the user gets to the front of the queue - setHintScreenTimeout(timeInMS)

  • This new method enables developers to set a timeout that makes sense for their specific use case.


Design Best Practices


We have experimented with a number of customization options with QR codes and here are some of the lessons learnt:



Dos


  • Do test with your equipment - Before deploying, test with your QR code readers to ensure that the QR code displayed on the wearable works with your equipment.

  • Do use black and white QR codes - This ensures maximum contrasts and makes it easier for the reader to read the information.

  • Do display only the core information in the text notification - Remember that less is more. Glanceability is important for wearables.

  • Do test with both round and square watches - The amount of text can be displayed on the notification varies especially dependent on the form factor (square and circular).

  • Do brand with icon - On the main notification in the Android Wear stream, developers can set a full color icon using setLargeIcon to brand your notification.

  • Do convey additional information using background - To achieve an even better result, consider setting context sensitive backgrounds through setBackground, such as a photo of the destination for the train or a picture of the stadium.

  • Do use QR codes which are 400x400 pixels or larger - In line with other background images, the recommended minimum size for QR code is 400x400 pixels.


Don'ts


  • Do not brand the QR code - The screen real estate is limited on Android Wear and using some of this for branding may result in the QR code not working correctly.

  • Do not use anything other than grey or default theme color for notification text - Although Android Wear notifications support basic text formatting such as setting text color, this should be used in moderation with the color set to default or grey. The reason is that the Holo theme for Android 4.x has a default background of black whereas Material Design theme for Android 5+ including Android Wear has a white background. This makes it hard for the colour to work for both themes. Bold and Italic are fine formatting choices.


Android Wear is for people on the move


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.



Join the discussion on



+Android Developers

Thursday, 15 January 2015

How Google Analytics helps you make better decisions for your apps

Posted by Russell Ketchum, Lead Product Manager, Google Analytics for Mobile Apps



Knowing how your customers use your app is the foundation to keeping them happy and engaged. It’s important to track downloads and user ratings, but the key to building a successful business is using data to dive deeper into understanding the full acquisition funnel and what makes users stick around.



Google Analytics is the easiest way to understand more about what your users are doing inside your app on Google Play, while also simultaneously tracking your users across the web and other mobile platforms. To show how Google Analytics can help, we've created a new "Analyze" section on the Android Developers website for you to check out. We provide guidance on how to design a measurement plan and implement effective in-app analytics – and take advantage of features only available between Google Play and Google Analytics.




The Google Play Referral Flow in Analytics



Google Analytics for mobile apps provides a comprehensive view into your app’s full user lifecycle, including user acquisition, composition, in app behavior, and key conversions. Our Analytics Academy course on mobile app analytics is also a great resource to learn the fundamentals.



Eltsoft LLC, a foreign language learning and education app developer for Android, recognized early on how impactful Google Analytics would have on the company's ability to quickly improve on its apps and meet user needs.



Analytics has really helped us to track the effectiveness of the changes to our app. I would say six months ago, that our success was a mystery. The data said we were doing well, but the whys were not clear. Therefore, we couldn’t replicate or push forward. But today, we understand what’s happening and can project our future success. We have not only the data, but can control certain variables allowing us to understand that data. - Jason Byrne, Eltsoft LLC



Here are some powerful tips to make the most of Google Analytics:



  1. Understand the full acquisition funnel

  2. Uniquely integrated with the Google Play Developer Console, Google Analytics gives you a comprehensive view of the Google Play Referral Flow. By linking Analytics to the Developer Console, you can track useful data on how users move through the acquisition flow from your marketing efforts to the Google Play store listing to the action of launching the app. If you find that a significant number of users browse your app in Google Play, but don’t install it, for example, you can then focus your efforts on improving your store listing.
  3. Unlock powerful insights on in-app purchases

  4. Monitoring in-app purchases in the Google Play Developer Console will show you the total revenue your app is generating, but it does not give you the full picture about your paying users. By instrumenting your app with the Google Analytics ecommerce tracking, you’ll get a fuller understanding of what paying users do inside your app. For example, you can find out which acquisition channels deliver users who stay engaged and go on to become the highest value users.
  5. Identify roadblocks and common paths with the Behavior Flow

  6. Understanding how users move through your app is best done with in-app analytics. With Google Analytics, you can easily spot if a significant percentage of users leave your app during a specific section. For example, if you see significant drop off on a certain level of your game, you may want to make that level easier, so that more users complete the level and progress through the game. Similarly, if you find users who complete a tutorial stay engaged with your app, you might put the tutorial front and center for first-time users.
  7. Segment your audience to find valuable insights

  8. Aggregated data can help you answer questions about overall trends in your app. If you want to unlock deeper insights about what drives your users’ behavior, you can slice and dice your data using segmentation, such as demographics, behavior, or install date. If something changes in one of your key metrics, segmentation can help you get to the root of the issue -- for example, was a recent app update unpopular with users from one geographic area, or were users with a certain device or carrier affected by a bug?
  9. Use custom data to measure what matters for your business

  10. Simply activating the Google Analytics library gives you many out-of-the-box metrics without additional work, such as daily and monthly active users, session duration, breakdowns by country, and many more variables. However, it’s likely that your app has many user actions or data types that are unique to it, which are critical to building an engaged user base. Google Analytics provides events, custom dimensions, and custom metrics so you can craft a measurement strategy that fits your app and business.
  11. No more one-size-fits-all ad strategy

  12. If you’re a developer using AdMob to monetize your app, you can now see all of your Analytics data in the AdMob dashboard. Running a successful app business is all about reaching the right user with the right ad or product at the right time. If you create specific user segments in Google Analytics, you can target each segment with different ad products. For example, try targeting past purchasers with in-app purchase ads, while monetizing users who don’t purchase through targeted advertising.


By measuring your app performance on a granular level, you will be able to make better decisions for your business. Successful developers build their measurement plan at the same time as building their app in order to set goals and track progress against key success metrics, but it’s never too late to start.



Choose the implementation that works best for your app to get started with Google Analytics today and find out more about what you can do in the new “Analyze” section of developers.android.com.



Join the discussion on



+Android Developers

Tuesday, 13 January 2015

Efficient Game Textures with Hardware Compression

Posted by Shanee Nishry, Developer Advocate



As you may know, high resolution textures contribute to better graphics and a more impressive game experience. Adaptive Scalable Texture Compression (ASTC) helps solve many of the challenges involved including reducing memory footprint and loading time and even increase performance and battery life.



If you have a lot of textures, you are probably already compressing them. Unfortunately, not all compression algorithms are made equal. PNG, JPG and other common formats are not GPU friendly. Some of the highest-quality algorithms today are proprietary and limited to certain GPUs. Until recently, the only broadly supported GPU accelerated formats were relatively primitive and produced poor results.



With the introduction of ASTC, a new compression technique invented by ARM and standardized by the Khronos group, we expect to see dramatic changes for the better. ASTC promises to be both high quality and broadly supported by future Android devices. But until devices with ASTC support become widely available, it’s important to understand the variety of legacy formats that exist today.



We will examine preferable compression formats which are supported on the GPU to help you reduce .apk size and loading times of your game.



Texture Compression


Popular compressed formats include PNG and JPG, which can’t be decoded directly by the GPU. As a consequence, they need to be decompressed before copying them to the GPU memory. Decompressing the textures takes time and leads to increased loading times.



A better option is to use hardware accelerated formats. These formats are lossy but have the advantage of being designed for the GPU.



This means they do not need to be decompressed before being copied and result in decreased loading times for the player and may even lead to increased performance due to hardware optimizations.



Hardware Accelerated Formats



Hardware accelerated formats have many benefits. As mentioned before, they help improve loading times and the runtime memory footprint.



Additionally, these formats help improve performance, battery life and reduce heating of the device, requiring less bandwidth while also consuming less energy.



There are two categories of hardware accelerated formats, standard and proprietary. This table shows the standard formats:









ETC1Supported on all Android devices with OpenGL ES 2.0 and above. Does not support alpha channel.
ETC2Requires OpenGL ES 3.0 and above.
ASTCHigher quality than ETC1 and ETC2. Supported with the Android Extension Pack.


As you can see, with higher OpenGL support you gain access to better formats. There are proprietary formats to replace ETC1, delivering higher quality and alpha channel support. These are shown in the following table:













ATC
Available with Adreno GPU.
PVRTCAvailable with a PowerVR GPU.
DXT1S3 DXT1 texture compression. Supported on devices running Nvidia Tegra platform.
S3TCS3 texture compression, nonspecific to DXT variant. Supported on devices running Nvidia Tegra platform.


That’s a lot of formats, revealing a different problem. How do you choose which format to use?



To best support all devices you need to create multiple apks using different texture formats. The Google Play developer console allows you to add multiple apks and will deliver the right one to the user based on their device. For more information check this page.



When a device only supports OpenGL ES 2.0 it is recommended to use a proprietary format to get the best results possible, this means making an apk for each hardware.



On devices with access to OpenGL ES 3.0 you can use ETC2. The GL_COMPRESSED_RGBA8_ETC2_EAC format is an improved version of ETC1 with added alpha support.



The best case is when the device supports the Android Extension Pack. Then you should use the ASTC format which has better quality and is more efficient than the other formats.



Adaptive Scalable Texture Compression (ASTC)


The Android Extension Pack has ASTC as a standard format, removing the need to have different formats for different devices.



In addition to being supported on modern hardware, ASTC also offers improved quality over other GPU formats by having full alpha support and better quality preservation.



ASTC is a block based texture compression algorithm developed by ARM. It offers multiple block footprints and bitrate options to lower the size of the final texture. The higher the block footprint, the smaller the final file but possibly more quality loss.



Note that some images compress better than others. Images with similar neighboring pixels tend to have better quality compared to images with vastly different neighboring pixels.



Let’s examine a texture to better understand ASTC:





This bitmap is 1.1MB uncompressed and 299KB when compressed as PNG.



Compressing the Android jellybean jar texture into ASTC through the Mali GPU Texture Compression Tool yields the following results.























Block Footprint4x46x68x8
Memory262KB119KB70KB
Image Output
Difference Map
5x Enhanced Difference Map


As you can see, the highest quality (4x4) bitrate for ASTC already gains over PNG in memory size. Unlike PNG, this gain stays even after copying the image to the GPU.



The tradeoff comes in the detail, so it is important to carefully examine textures when compressing them to see how much compression is acceptable.



Conclusion


Using hardware accelerated textures in your games will help you reduce the size of your .apk, runtime memory use as well as loading times.



Improve performance on a wider range of devices by uploading multiple apks with different GPU texture formats and declaring the texture type in the AndroidManifest.xml.



If you are aiming for high end devices, make sure to use ASTC which is included in the Android Extension Pack.



Followers