Mobility

Google Awareness API: The smart person's guide

Want to add a bit of contextual awareness to your Android app? Then you need to learn to use the Google Awareness API.

Image: Google

There are hundreds, even thousands, of Android apps on the market, and chances are at least a few of them are similar to yours. If you want your app to be more than just another choice in a sea of options you need to do everything you can to make it better.

More about Mobility

Field of digital dreams: Why MLB is betting its future on big data, Wi-Fi, apps, and AR

It's a whole new ball game for Major League Baseball in tech upgrades. TechRepublic goes inside the digital transformations of two of the league's most storied franchises.

Could your app benefit from real-time feedback based on location, weather, time, user activity, geotagged place, proximity to a beacon, or the status of the device's headphones? If so, the Google Awareness API could make your life a lot easier.

TechRepublic's smart person's guide about the Google Awareness API is a quick introduction to this Android API, as well as a "living" guide that will be updated periodically as new features are released.

SEE: All of TechRepublic's smart person's guides

Executive summary

  • What is the Google Awareness API? It is an API that allows apps to easily make use of seven types of contextual data. It can also manage system resources on its own to minimize its impact on devices.
  • Why does the Google Awareness API matter? Prior to its release much of the work the Awareness API did had to be programmed manually. Now it's as easy as plugging the API into an app to get all the benefits of contextual awareness.
  • Who does the Google Awareness API affect? It affects both developers and users. Devs save time, and users get better app results. It's a win-win.
  • When is the Google Awareness API happening? The Awareness API was first announced at Google I/O 2016, and is now available to developers to use in their apps.
  • How do I make use of the Google Awareness API? The Awareness API can be incorporated into existing apps or programmed into new ones. There are a few hoops to jump through, but they're worth it for the benefits the API offers.

SEE: Video: Samsung Galaxy S8 and S8 Plus: The 3 most important features (TechRepublic)

What is the Google Awareness API?

Contextual awareness is important in modern mobile apps. Being able to tell where a user is, what the weather is like, and recognizing other daily variables makes an app much more useful and can be the difference between three- and five-star ratings.

The Google Awareness API rolls seven contexts into one API:

  • Local time
  • Device latitude and longitude
  • Place (as in a business, park, etc.)
  • User activity (walking, biking, etc.)
  • Nearby Eddystone beacons
  • Whether or not headphones are plugged in (and knowing when they are)
  • Local weather conditions

Apps can use those contexts to perform various actions, such as asking a user if they want to start a certain playlist because they plugged in their headphones, whether they want to see coupons for a store they are near, or if they want info on activities for a sunny day in the park they are in.

The Google Awareness API is made up of two APIs that perform very different functions:

  • Fence API: This is the API that notifies users when a combination of conditions are met, like in the examples above.
  • Snapshot API: This lets an app request a snapshot of any combination of the seven contexts' current status. It can be used to do things like provide a weather forecast.

While these features aren't groundbreaking, their simplicity and integration is: All you need to do is integrate the API and have your app make the necessary calls.

The Google Awareness API is also designed to manage system resources on its own, so using it shouldn't cause additional battery drain or require more processing power. Google says the Awareness API monitors its battery and data usage itself, so ideally developers won't have to worry about modifying any part of their apps, aside from adding calls.

Additional resources

Why does the Google Awareness API matter?

The Google Awareness API can vastly simplify programming context-aware Android apps, and for busy developers that's never a bad thing. The information that the Google Awareness API can gather and make use of has incredible benefits for app users, which could be just what you need to catapult your app to the top of the Play Store.

Additional resources

Who does the Google Awareness API affect?

The Google Awareness API broadly affects two types of people: Those who program Android apps and those who use them.

More specifically, the Google Awareness API affects developers because of the power it unlocks. With little additional work an app can be made aware of location, weather, time, place, and other contextual data, making it far more valuable than it would be otherwise.

Users don't care how APIs work, nor do they care how much work it takes for you to add contextual functions: They just care that your app is useful, it's there when they need it, and it's ever present yet unobtrusive. Programming that yourself can be tricky, but the Google Awareness API can make it simple.

Why duplicate the work when Google has already done it for you?

Additional resources

When is the Google Awareness API happening?

Google announced the Awareness API at Google I/O 2016, and it was seen as one of the big things to come out of last year's event. It's available to use now, and Google has extensive guides on incorporating it into new and existing Android apps.

Additional resources

How do I make use of the Google Awareness API?

Integrating the Awareness API is similar to adding other APIs to apps, but there are a few additional things you need to do. Since Awareness API is part of Google Play Services you'll need a Google account and familiarity with using Play Services in your apps.

It's not a bad idea to use Google's Awareness API guide to give yourself a quick crash course. It's a brief read, and anyone familiar with Android coding and API integration will find it easy to understand.

Additional resources

About Brandon Vigliarolo

Brandon writes about apps and software for TechRepublic. He's an award-winning feature writer who previously worked as an IT professional and served as an MP in the US Army.

Editor's Picks

Free Newsletters, In your Inbox