Introducing Trash Can: Data Recovery in Google Analytics

We all make mistakes, but the damage might seem irrevocable when accidentally deleting crucial reporting information from Google Analytics. Thanks to feedback from our users, we’re pleased to introduce a new feature to provide a safety net each time you delete a view, property or account from your Google Analytics account: the Trash Can.
To get started, navigate to the Administration tab, select an account, and click the Trash Can feature on the left-hand panel. Check off what you want to reclaim, click “Restore,” and voilà! Your view, property or account is now just as it was before you deleted it. Once 35 days pass from the day you originally trashed it, however, you’ll have to say a final goodbye as the data will be removed from the Trash Can and will no longer appear there. 

This feature will be rolling out to all Google Analytics accounts in the coming weeks, but don’t worry–anything you’ve deleted starting today will still show up in the Trash Can once you get the feature update in your account. 
Many people rely on Google Analytics to collect, analyze, and report on data in order to make good business decisions. We hope that the Trash Can is just one more way to ensure that you have all the information you need when you need it. To learn more details about the Trash Can feature, please read this Help Center article.
Posted by Chris Cahill, Michael Masukawa, and Dan Morenus

Introducing Trash Can: Data Recovery in Google Analytics

We all make mistakes, but the damage might seem irrevocable when accidentally deleting crucial reporting information from Google Analytics. Thanks to feedback from our users, we’re pleased to introduce a new feature to provide a safety net each time you delete a view, property or account from your Google Analytics account: the Trash Can.
To get started, navigate to the Administration tab, select an account, and click the Trash Can feature on the left-hand panel. Check off what you want to reclaim, click “Restore,” and voilà! Your view, property or account is now just as it was before you deleted it. Once 35 days pass from the day you originally trashed it, however, you’ll have to say a final goodbye as the data will be removed from the Trash Can and will no longer appear there. 

This feature will be rolling out to all Google Analytics accounts in the coming weeks, but don’t worry–anything you’ve deleted starting today will still show up in the Trash Can once you get the feature update in your account. 
Many people rely on Google Analytics to collect, analyze, and report on data in order to make good business decisions. We hope that the Trash Can is just one more way to ensure that you have all the information you need when you need it. To learn more details about the Trash Can feature, please read this Help Center article.
Posted by Chris Cahill, Michael Masukawa, and Dan Morenus

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 croppedsetHintAvoidBackgroundClipping(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 queuesetHintScreenTimeout(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 400×400 pixels or larger – In line with other background images, the recommended minimum size for QR code is 400×400 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

How to tell if you’re about to make a really bad decision – a flowchart

How to tell if you're about to make a really bad decision - a flowchart

View

Retailers: Three Insights to Drive Q1 Results

Now that we’ve survived the holiday season, it’s time to get the year started with some Q1 insights from Google Analytics!  Over the holiday season, retailers are inundated with data about the best shopping days, when to start their sales, and predictions about which items will be popular.  But what to do once the furor dies down?  How can retailers make the most of Q1?  
Here at Google Analytics, we delved into our Q1 data from 2013 and 2014 in the US to provide some insights to guide you in the first quarter of 2015.  In particular, the weeks around Valentine’s Day and the Super Bowl provided some notable trends.  Our analysis encompasses millions of businesses large and small who are using Google Analytics.  See the end of this article for more about our dataset.
The Day of the Big Game:  A Low Point for Online Shopping
We took a look at the first big marketing event of Q1:  Super Bowl Sunday.  The day of the big game, we saw lower numbers across the board.  Sessions were down 11% compared to the average for the quarter.  Similarly, transactions and conversion rates were down on average 16% and 5% respectively.  In both 2013 and 2014, the sessions and transaction numbers for the day of the Super Bowl fall into the bottom quartile for the quarter.
Clearly, on the day of the game, online purchasing is not a priority.  However, as we see later on in this post, this period of time serves as the turning point for transactions and conversion rates in the quarter.  The brand advertising that is such a big part of Super Bowl Sunday may help businesses capitalize on increased consumer buying behavior later in the quarter.
Best Romantic Shopping Day:  The Sunday before Valentine’s Day
We also delved into the second big marketing event of Q1:  Valentine’s Day.  In particular, we evaluated the week preceding the big day to find any pre-holiday patterns.  It turns out that in both 2013 and 2014, the Sunday before Valentine’s Day sees the biggest spike in week-over-week transactions with an average bump of 10%.  The same holds true for conversion rates and sessions, with an average increase of 6% and 4% respectively.  Besides a week-over-week increase, we also see that transactions are 5% higher on that day than for the average Sunday in the quarter.  The bump in transactions could indicate that consumers are using that Sunday to find and purchase their gifts, making it a good opportunity to invest in getting consumers to your site for some Valentine’s Day shopping.  If you plan to invest in advertising for this holiday, one way to prepare for Valentine’s Day is to adjust your bids.
Between the Super Bowl and Valentine’s Day:  The Q1 Turning Point
Unless you’re lucky enough to sell items for diet, exercise, or other big new year’s resolutions, retailers often see sales slow in Q1 as consumers reduce gift-buying.  The chart below shows that for most of January, transactions are indeed below the average for the quarter.  
When should retailers spend marketing dollars to bounce back from this holiday hangover?  We see that transactions in both 2013 and 2014 start to ramp up as the key marketing dates approach: Valentine’s Day and Super Bowl Sunday.  In particular, the week of February 5th (also known as the week after the Super Bowl and the week before Valentine’s Day) marks the first time that transactions hit the average or above for the quarter.  
The graph below shows that in 2013 the week after the Super Bowl was above the average, whereas in 2014 that week was at the quarterly average.  In both years, this week has the highest week over week growth in transactions and conversions rates for Q1 at 6% for both metrics.  Sessions, however, display only a 0.4% increase week-over-week, not even close to being the highest for the quarter.  Based on this information about sessions, it’s clear that the uptick in buying behavior is not simply a function of consumers spending more time online, it’s an indication of increased intent to purchase during the time they do spend online.  If we look at average conversion rates before that week compared to the average conversion rates for that week and the rest of the quarter, we see a 6% increase.

So, as you plan your budgets, promotions, and campaigns in Q1, keep in mind that consumer activity will tend to increase throughout the quarter.  In particular, transactions tend to get a big bump during the week between Super Bowl Sunday and Valentine’s Day.  We know it’s hard to get back in gear after the holidays, but we hope our insights will help you think clearly and creatively about your marketing plans in the first quarter.
About the Data & Charts 
In order to perform this analysis, we looked at billions of sessions from authorized Google Analytics clients who have shared their website data anonymously (read more).

Announcing Exploding Kittens – a card game for people who are into kittens and explosions and laser beams and sometimes goats

Announcing Exploding Kittens - a card game for people who are into kittens and explosions and laser beams and sometimes goats

I helped created a new card game and it’s called Exploding Kittens.

View

Some thoughts on food

Some thoughts on food

View

AccuWeather Unlocks Cross-Channel Impact Using Google Analytics Premium

“The ability to overlay our own data on top of traditional dimensions and metrics has provided valuable insights into the kind of information our consumers are looking for.” 

– Steve Mummey, Director of Browser Products at AccuWeather
AccuWeather is the world’s largest weather media company with over 1 billion people a day relying on AccuWeather’s suite of products to give them real-time weather information. Today we wanted to highlight AccuWeather’s success with the Measurement Protocol in Google Analytics Premium. The Measurement Protocol is a feature where businesses can send requests to Google Analytics from countless customer touchpoints. 
Measuring the complete customer journey
AccuWeather needed to find a way to increase the impact of digital across all its channels and products. They were determined to find a robust solution that collected data from each customer touchpoint to give a comprehensive analysis to make better business decisions.
The team wanted to sought out accomplish four goals: 1) analyze the effectiveness of weather forecast emails 2) attribute credit to campaigns that drove users to app store pages, 3) better understand their mobile audience, and 4) collect this new data without compromising AccuWeather’s fast and simple user experience.
Google Analytics Premium solves the challenge
Using Google Analytics Premium, plus the Measurement Protocol, allowed AccuWeather to report on a variety of the company’s services simultaneously from one source. AccuWeather was able to have information from emails, mobile devices, and QR codes sent through the Measurement Protocol. This feature provided the AccuWeather team with a complete picture in the Google Analytics reporting interface alongside their other metrics.
Data-driven decisions that drive action
As a result of the sophisticated and comprehensive set of Google Analytics Premium features, AccuWeather has been able to more accurately identify the source of app downloads to track application traffic from QR codes and other offline campaigns to the app stores.
The team’s analysis revealed that 10% of the brand’s mobile traffic came from devices that either did not support JavaScript or had the feature disabled. Without using the Measurement Protocol in Google Analytics Premium, they would never have been able to account for this portion of its audience. The team can now include this audience in its product and monetization decisions.
Pleased with the success of this solution, AccuWeather now plans to apply it to other parts of its business to uncover new insights, new leads, and, of course, new customers. 
You can read AccuWeather’s full story and dive deeper into the results here. To learn more on the Measurement Protocol, check out this video.
Posted by: the Google Analytics Premium team

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

Should you buy a selfie stick?

Should you buy a selfie stick?

A handy guide for shoppers.

View

The word “moist” – a flowchart

The word

View

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:


ETC1 Supported on all Android devices with OpenGL ES 2.0 and above. Does not support alpha channel.
ETC2 Requires OpenGL ES 3.0 and above.
ASTC Higher 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.
PVRTC Available with a PowerVR GPU.
DXT1 S3 DXT1 texture compression. Supported on devices running Nvidia Tegra platform.
S3TC S3 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 Footprint 4×4 6×6 8×8
Memory 262KB 119KB 70KB
Image Output
Difference Map
5x Enhanced Difference Map

As you can see, the highest quality (4×4) 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.

Simplify your Google Analytics Reporting with Add-ons for Google Sheets

It’s common for Google Analytics users to use spreadsheets to analyze their Google Analytics data or combine it with another data source. But exporting your data from Google Analytics to Google Sheets is a manual process, and it can be tedious if you run reports frequently or manage multiple accounts. With the release of Add-ons for Google Sheets, getting your Google Analytics data into Google Sheets has never been easier!
Add-ons allow you to extend the power of Google Sheets by automating common tasks and integrating with external services. The Google Analytics Spreadsheet Add-on allows you to access your Google Analytics data, right from within a spreadsheet!

The Google Analytics Spreadsheet Add-on
The Google Analytics Spreadsheet Add-on combines the power of the Google Analytics API with the rich feature set of Google Sheets, making it easier for Google Analytics users to access, visualize, share, and manage their data. With this add-on you can:
  • Query and report data from multiple views.
  • Compute and display custom calculations.
  • Create visualizations and embed those visualizations on third-party websites.
  • Schedule your reports to run and update automatically.
  • Control who can see your data and visualizations by using Google Sheets’ sharing and privacy features.
But perhaps the best way to find out what the Google Analytics Spreadsheet Add-on can do is to see it in action. In this short video I introduce the add-on, show you how to install it, and walk you through creating your first report.

If you want to go deeper, you can watch this more advanced video where I explain in detail the process of building a complete dashboard that automatically updates and can be embedded on a third-party website.
If you have more questions about how to use the add-on, check out the documentation. It explains each of its features and configuration options in much more detail.

Supermetrics and Analytics Canvas add-ons
The Google Analytics Spreadsheet Add-on gives users a powerful yet user-friendly way to access their Google Analytics data, but it doesn’t solve all business integration needs.
For more advanced business and data-integration solutions, I strongly recommend trying out these two excellent Google Sheets add-ons created by our technology partners:
Both of these add-ons integrate with Google Analytics as well as a variety of other platforms and services such as Facebook, Twitter, Microsoft Office, and many more. Free and premium versions are available. 

Feedback and Support
Add-ons are a great way to automate the process of getting your Google Analytics data into Google Sheets. We hope you take the time to try out these add-ons and see how they can improve your workflow.
If you use the Google Analytics Spreadsheet Add-on, we’d love to know what you think. You can leave a review in the Chrome Web Store, ask any questions you have in the add-on discussion group, or submit feedback directly from within Google Sheets.
Any and all feedback is welcome!

By: Philip Walton, Developer Programs Engineer, Google Analytics

Boost Conversions by Infusing Google Remarketing with Marketo Real-Time Personalization

Personalization is a hot topic for today’s marketers, a group that spends nearly half of their budget attracting new prospects. But customer expectations have risen; content must be relevant to acquire new customers and move them to convert.

Some pioneering marketers are seeing better performance by using real-time personalization and remarketing simultaneously. Knowing who a customer is and what they do is a big step toward providing the hyper-relevant content that customers crave.

Join Marketo’s Mike Telem and Mike Tomita on January 15th at 10am PT/ 1pm ET as they discuss the importance of real-time personalization for marketing results. Google’s own Dan Stone will give an overview of the ways Google Analytics technology can be used to power advanced remarketing, while the Marketo team will share the ways their company uses real-time personalization and Google Analytics to generate more leads at a lower cost.

Looking for tips on how to get your organization started? Reserve your spot today!

Mary Worth: Some Enchanted Evening

   
View Original / Modified

6 things I learned from riding in a Google Self-Driving Car

6 things I learned from riding in a Google Self-Driving Car

Google invited me down to Mountain View to preview the latest generation of their self-driving cars.

View

6 things I learned from riding in a Google Self-Driving Car

6 things I learned from riding in a Google Self-Driving Car

Google invited me down to Mountain View to preview the latest generation of their self-driving cars.

View

Build Mobile App Services with Google Cloud Tools for Android Studio v1.0

Posted by Chris Sells, Product Manager, Cloud Tools for Android Studio

Cloud Tools for Android Studio allows you to simultaneously build the service- and client-side of your mobile app. Earlier this month, we announced the release of Android Studio 1.0 that showed just how much raw functionality there is available for Android app developers. However, the client isn’t the whole picture, as most mobile apps also need one or more web services. It was for this reason that the Cloud Tools for Android Studio were created.

Cloud Tools put the power of Google App Engine in the same IDE alongside of your mobile client, giving you all the same Java language tools for both sides of your app, as well as making it far easier for you to keep them in sync as each of them changes.

Getting Started

To get started with Cloud Tools for Android Studio, add a New Module to your Android Studio project, choose Google Cloud Module and you’ll have three choices:

You can add three Google Cloud module types to your Android Studio project

The Java Servlet Module gives you a plain servlet class for you to implement as you see fit. If you’d like help building your REST endpoints with declarative routing and HTTP verbs and automatic Java object serialization to and from JSON, then you’ll want the Java Endpoints Module. If you want the power of endpoints, along with the ability to send notifications from your server to your clients, then choose Backend with Google Cloud Messaging.

Once you’re done, you’ll have your service code right next to your client code:

You can build your mobile app’s client and service code together in a single project

Not only does this make it very convenient to build and test your entire end-to-end, but we also dropped a little extra something into your app’s build.gradle file:

The android-endpoints configuration build step in your build.gradle file creates a client-side library for your server-side endpoint

The updated Gradle file will now create a library for use in your app’s client code that changes when your service API changes. This library lets you call into your service from your client and provides full code completion as you do:

The client-side endpoint library provides code completion and documentation

Instead of writing the code to create HTTP requests by hand, you can make calls via the library in a typesafe manner and the marshalling from JSON to Java will be handled for you, just like on the server-side (but in reverse, of course).

Endpoints Error Detection

Meanwhile, back on the server-side, as you make changes to your endpoints, we’re watching to make sure that they’re in good working order even before you compile by checking the attributes as you type:

Cloud Tools will detect errors in your endpoint attributes

Here, Cloud Tools have found a duplicate name in the ApiMethod attribute, which is easy to do if you’re creating a new method from an existing method.

Creating an Endpoint from an Objectify Entity

If, as part of your endpoint implementation, you decide to take advantage of the popular Objectify library, you’ll find that Cloud Tools provides special support for you. When you right-click (or control-click on the Mac) on a file containing an Objectify entity class, you’ll get the Generate Cloud Endpoint from Java class option:

The generate Cloud Endpoint from Java class option will create a CRUD endpoint for you

If you’re running this option on a Java class that isn’t built with Objectify, then you’re going to get an endpoint with empty methods for get and insert operations that you can implement as appropriate. However, if you do this with an Objectify entity, you’ll get a fully implemented endpoint:

Cloud Tools has built-in support for generating Objectify-based cloud endpoint implementations

Using your Cloud Endpoint

As an Android developer, you’re used to deploying your client first in the emulator and then into a local device. Likewise, with the service, you’ll want to test first to your local machine and then, when you’re ready, deploy into a Google App Engine project. You can run your service app locally by simply choosing it from the Configurations menu dropdown on the toolbar and pressing the Run button:

The Configurations menu in the toolbar lets you launch your service for testing

This will build and execute your service on http://localhost:8080/ (by default) so that you can test against it with your Android app running in the emulator. Once you’re ready to deploy to Google Cloud Platform, you can do so by selecting the Deploy Module to App Engine option from the Build menu, where you’ll be able to choose the source module you want to deploy, log into your Google account and pick the target project to which you’d like to deploy:

The Deploy to App Engine dialog will use your Google credentials to enumerate your projects for you

Cloud Tools beta required some extra copying and pasting to get the Google login to work, but all of that’s gone now in this release.

What’s Next?

We’re excited to get this release into your hands, so if you’ve haven’t downloaded it yet, then go download Android Studio 1.0 right now! To take advantage of Cloud Tools for Android Studio, you’ll want to sign up for a free Google Cloud Platform trial. Nothing is stopping you from building great Android apps from front to back. If you’ve got suggestions, drop us a line so that we can keep improving. We’re just getting started putting Google Cloud Platform tools in your hands. We can’t wait to see what you’ll build.

Google Play game services ends year with a bang!

Posted by Benjamin Frenkel, Product Manager, Play Games

In an effort to supercharge our Google Play games services (GPGS) developer tools, we’re introducing the Game services Publishing API, a revamped Unity Plugin, additional enhancements to the C++ SDK, and improved Leaderboard Tamper Protection.

Let’s dig into what’s new for developers:

Publishing API to automate game services configuration

At Google I/O this past June, the pubsite team launched the Google Play Developer Publishing APIs to automate the configuration and publishing of applications to the Play store. Game developers can now also use the Google Play game services Publishing API to automate the configuration and publishing of game services resources, starting with achievements and leaderboards.

For example, if you plan on publishing your game in multiple languages, the game services Publishing API will enable you to pull translation data from spreadsheets, CSVs, or a Content Management System (CMS) and automatically apply those translations to your achievements.

Early adopter Square Enix believes the game services Publishing API will be an indispensable tool to manage global game rollouts:

Achievements are the most used feature in Google Play game services for us. As our games support more languages, achievement management has become increasingly difficult. With the game services Publishing API, we can automate this process, which is really helpful. The game services Publishing API also comes with great samples that we were able to easily customize for our needs

Keisuke Hata, Manager / Technical Director, SQUARE ENIX Co., Ltd.

To get started today, take a look at the developer documentation here.

Updated Unity plugin and Cross-platform C++ SDK

  • Unity plugin Saved Games support: You can now take advantage of the Saved Games feature directly from the Unity plugin, with more storage and greater discoverability through the Play Games app
  • New Unity plugin architecture: We’ve rewritten the plugin on top of our cross-platform C++ SDK to speed up feature development across SDKs and increase our responsiveness to your feedback
  • Improved Unity generated Xcode project setup: You now have a much more robust way to generate Xcode projects integrated with Google Play Game Services in Unity
  • Updated and improved Unity samples: We’ve updated our sample codes to make it easier for first time developers to integrate Google Play games services
  • C++ SDK support for iPhone 6 Plus: You can now take advantage of the out-of-box games services UI (e.g., for leaderboards and achievements) for larger form factor devices, such as the iPhone 6 Plus

We also include some important bug fixes and stability improvements. Check out the release notes for the Unity Plugin and the getting started page for the C++ SDK for more details.

Leaderboard Tamper Protection

Turn on Leaderboard Tamper Protection to automatically hide suspected tampered scores from your leaderboards. To enable tamper protection on an existing leaderboard, go to your leaderboard in the Play developer console and flip the “Leaderboard tamper protection” toggle to on. Tamper protection will be on by default for new leaderboards.Learn more.

To learn more about cleaning up previously submitted suspicious scores refer to the Google Play game services Management APIs documentation or get the web demo console for the Management API directly from github here.

In addition, if you prefer command-line tools, you can use the python-based option here.

Making a performant watch face

Posted by Hoi Lam, Developer Advocate, Android Wear

What’s a better holiday gift than great performance? You’ve got a great watch face idea — now, you want to make sure the face you’re presenting to the world is one of care and attention to detail.

At the core of the watch face’s process is an onDraw method for canvas operations. This allows maximum flexibility for your design, but also comes with a few performance caveats. In this blog post, we will mainly focus on performance using the real life journey of how we optimised the Santa Tracker watch face, more than doubling the number of fps (from 18 fps to 42 fps) and making the animation sub-pixel smooth.

Starting point – 18 fps

Our Santa watch face contains a number of overlapping bitmaps that are used to achieve our final image. Here’s a list of them from bottom to top:

  1. Background (static)
  2. Clouds which move to the middle
  3. Tick marks (static)
  4. Santa figure and sledge (static)
  5. Santa’s hands – hours and minutes
  6. Santa’s head (static)

The journey begins with these images…

Large images kill performance (+14 fps)

Image size is critical to performance in a Wear application, especially if the images will be scaled and rotated. Wasted pixel space (like Santa’s arm here) is a common asset mistake:

Before: 584 x 584 = 341,056 pixels After: 48*226 = 10,848 (97% reduction)

It’s tempting to use bitmaps from the original mock up that have the exact location of watch arms and components in absolute space. Sadly, this creates problems, like in Santa’s arm here. While the arm is in the correct position, even transparent pixels increase the size of the image, which can cause performance problems due to memory fetch. You’ll want to work with your design team to extract padding and rotational information from the images, and rely on the system to apply the transformations on our behalf.

Since the original image covers the entire screen, even though the bitmap is mostly transparent, the system still needs to check every pixel to see if they have been impacted. Cutting down the area results in significant gains in performance. After correcting both of the arms, the Santa watch face frame rate increased by 10 fps to 28 fps (fps up 56%). We saved another 4 fps (fps up 22%) by cropping Santa’s face and figure layer. 14 fps gained, not bad!

Combine Bitmaps (+7 fps)

Although it would be ideal to have the watch tick marks on top of our clouds, it actually does not make much difference visually as the clouds themselves are transparent. Therefore there is an opportunity to combine the background with the ticks.


+

When we combined these two views together, it meant that the watch needed to spend less time doing alpha blending operations between them, saving precious CPU time. So, consider collapsing alpha blended resources wherever we can in order to increase performance. By combining two full screen bitmaps, we were able to gain another 7 fps (fps up 39%).

Anti-alias vs FilterBitmap flags – what should you use? (+2 fps)

Android Wear watches come in all shapes and sizes. As a result, it is sometimes necessary to resize a bitmap before drawing on the screen. However, it is not always clear what options developers should select to make sure that the bitmap comes out smoothly. With canvas.drawBitmap, developers need to feed in a Paint object. There are two important options to set – they are anti-alias and FilterBitmap. Here’s our advice:

  • Anti-alias does not do anything for bitmaps with transparent edges. We often switch on the anti-alias option by default as developers when we are creating a Paint object. However, this option only really makes sense for vector objects. For bitmaps, this is used to blend the rectangular edges if it is rotated or skewed and it has no impact if the edge pixels are transparent (as we would imagine most watch face arms would be). The hand on the left below has anti-alias switched on, the one on the right has it switched off. So turn off anti-aliasing for bitmaps to gain performance back. For our watch face, we gained another 2 fps (fps up 11%) by switching this option off.
  • Switch on FilterBitmap for all bitmap objects which are on top of other objects – this option smooths the edges when drawBitmap is called. This should not be confused with the filter option on Bitmap.createScaledBitmap for resizing bitmaps. We need both to be turned on. The bitmaps below are the magnified view of Santa’s hand. The one on the left has FilterBitmap switched off and the one on the right has FilterBitmap switched on.

Eliminate expensive calls in the onDraw loop (+3 fps)

onDraw is the most critical function call in watch faces. It’s called for every drawable frame, and the actual painting process cannot move forward until it’s finished. As such, our onDraw method should be as light and as performant as possible. Here’s some common problems that developers run into that can be avoided:

  1. Do move heavy and common code to a precompute function – e.g. if we commonly grab R.array.cloudDegrees, try doing that in onCreate, and just referencing it in the onDraw loop.
  2. Don’t repeat the same image transform in onDraw – it’s common to resize bitmaps at runtime to fit the screen size but this is not available in onCreate. To avoid resizing the bitmap over and over again in onDraw, override onSurfaceChanged where width and height information are available and resize images there.
  3. Don’t allocate objects in onDraw – this leads to high memory churn which will force garbage collection events to kick off, killing frame rates.
  4. Do analyze the CPU performance by using a tool such as the Android Device Monitor. It’s important that the onDraw execution time is short and occurs in a regular period.

Following these simple rules will improve rendering performance drastically.

In the first version, the Santa onDraw routine has a rogue line:

int[] cloudDegrees = 
    getResources().getIntArray(R.array.cloudDegrees);

This loads the int array on every call from resources which is expensive. By eliminating this, we gained another 3 fps (fps up 17%).

Sub-pixel smooth animation (-2 fps)

For those keeping count, we should be 44 fps, so why is the end product 42 fps? The reason is a limitation with canvas.drawBitmap. Although this command takes left and top positioning settings as a float, the API actually only deals with integers if it is purely translational for backwards compatibility reasons. As a result, the cloud can only move in increments of a whole pixel resulting in janky animations. In order to be sub-pixel smooth, we actually need to draw and then rotate rather than having pre-rotate clouds which moves towards Santa. This additional rotation costs us 2 fps. However, the effect is worthwhile as the animation is now sub-pixel smooth.

Before – fast but janky and wobbly

for (int i = 0; i < mCloudBitmaps.length; i++) {
    float r = centerX - (timeElapsed / mCloudSpeeds[i]) % centerX;
    float x = centerX + 
        -1 * (r * (float) Math.cos(Math.toRadians(cloudDegrees[i] + 90)));
    float y = centerY - 
        r * (float) Math.sin(Math.toRadians(cloudDegrees[i] + 90));
    mCloudFilterPaints[i].setAlpha((int) (r/centerX * 255));
    Bitmap cloud = mCloudBitmaps[i];
    canvas.drawBitmap(cloud,
        x - cloud.getWidth() / 2,
        y - cloud.getHeight() / 2,
        mCloudFilterPaints[i]);
}

After - slightly slower but sub-pixel smooth

for (int i = 0; i < mCloudBitmaps.length; i++) {
    canvas.save();
    canvas.rotate(mCloudDegrees[i], centerX, centerY);
    float r = centerX - (timeElapsed / (mCloudSpeeds[i])) % centerX;
    mCloudFilterPaints[i].setAlpha((int) (r / centerX * 255));
    canvas.drawBitmap(mCloudBitmaps[i], centerX, centerY - r,
        mCloudFilterPaints[i]);
    canvas.restore();
}

Before: Integer translation values create janky, wobbly animation. After: smooth sailing!

Quality on every wrist

The watch face is the most prominent UI element in Android Wear. As craftspeople, it is our responsibility to make it shine. Let’s put quality on every wrist!