Google Simplifies Mobile Back-End Development
Google Inc. today announced new features to help Android developers connect their mobile apps to a cloud-based back-end platform.
Google Cloud Save will facilitate saving, retrieving and synchronizing user data -- for example, preferences or user state -- without developers needing to code up a back-end themselves.
Cloud Tools for Android Studio makes it easier to add an App Engine back-end to an app, with module templates for back-end services such as endpoint scaffolding or push notifications.
The back-end services are similar to initiatives from other mobile and cloud providers, such as Microsoft Azure Mobile Services, which is designed to provide a framework for saving app data in the cloud, send push notifications and add custom back-end logic for apps.
"Whether it's building basic plumbing, or just trying to load and save data in a network- and battery-efficient way, spending time dealing with the back-end can take precious time away from building an awesome app," said Jason Polites of the Cloud Platform team in a blog post today.
Polites used the term "app-nesia" to describe the loss of user data stored only on a device -- such as preferences -- when an app needs to be reinstalled. Saving such data automatically to cloud storage also helps to synchronize user state across multiple devices.
"We handle all the back-end logic, as well as the synchronization services on the client," Polites said. "The synchronization services work in the background, providing offline support for the data, and minimizing impact on the battery. All you need to do is tell us when and what to save."
Developers do that with four methods to provide create, retrieve, update and delete (CRUD) functionality and force data synchronizations. Locally stored data is synchronized automatically in the background, saved on the back-end in Google Cloud Datastore. Any changes to the data on the back-end platform will be automatically synced to devices. "Importantly, this per-user data belongs to you, the developer, and [is] stored in your own Google Cloud Datastore database," Polites said.
The data can be accessed from Google App Engine or Google Compute Engine instances.
To make it easier to add an App Engine back-end to an app, the new Cloud Tools for Android Studio come into play, providing three module templates: App Engine Java Servlet Module for a minimal back-end; App Engine Java Endpoints Module for basic endpoint scaffolding; and App Engine with Google Cloud Messaging to wire up push notifications.
Choosing one of these templates automatically updates a project with a new Gradle module containing the back-end. Gradle is a build automation service.
"Once you've added the back-end module to your Android application, you can use Google Cloud Endpoints to streamline the communication between your back-end and your Android app," Polites said. "Cloud Endpoints automatically generates strongly typed, mobile-optimized client libraries from simple Java server-side API annotations, automates Java object marshalling to and from JSON, and provides built-in OAuth 2.0 support. On deployment, this annotated Endpoints API definition class generates a RESTful API."
Google Cloud Save is in private beta, and interested developers can sign up to participate.
David Ramel is the editor of Visual Studio Magazine.