Android Studio lets you easily add a cloud backend to your application, right from your IDE. A backend allows you to implement functionality such as backing up user data to the cloud, serving content to client apps, real-time interactions, sending push notifications through Google Cloud Messaging for Android (GCM), and more. Additionally, having your application’s backend hosted on Google App Engine means that you can focus on what the cloud application does, without having to worry about administration, reliability or scalability.
When you create a backend using Android Studio, it generates a new App Engine application under the same project, and gives your Android application the necessary libraries and a sample activity to interact with that backend. Support for GCM is built-in, making it easy to sync data across multiple devices. Once you've generated the project, you can build and run your client and server code together, in a single environment, and even deploy your backend code right from Android Studio.
In this post we’ll focus on how to get started with the basic setup. From there it's easy to extend the basic setup to meet your needs.
Before you get started, make sure you take care of these tasks first:
In Android Studio, open an existing Android application that you want to modify, or create a new one. Select the Android app module under the Project node. Then click Tools > Google Cloud Endpoints > Create App Engine Backend.
In the wizard, enter the Project ID, Project Number, and API Key of your Cloud project.
This will create:
RegisterActivity
The generated App Engine application (<app_name>-AppEngine) is an Apache Maven-based project. The Maven pom.xml file takes care of downloading all the dependencies, including the App Engine SDK. This module also contains the following:
DeviceInfoEndpoint.java
DeviceInfo.java
MessageEndpoint.java
The endpoints module (<app_name>-endpoints) generated for you contains the classes and libraries needed by the Android application to interact with the backend:
RegisterActivity.java
DeviceInfoEndpoint
In your Android application, you can call RegisterActivity whenever you want the registration to take place (for example, from within the onCreate() method of your main activity.
onCreate()
... import android.content.Intent; ... @Override protected void onCreate(Bundle savedInstanceState) { ... Intent intent = new Intent(this, RegisterActivity.class); startActivity(intent); }
When you're ready to deploy an update to your ( the sample ) production backend in the cloud, you can do that easily from the IDE. Click on the “Maven Projects” button on the right edge of the IDE, under Plugins > App Engine, right-click and run the appengine:update goal.
As soon as the update is deployed, you can also access your endpoints through the APIs Explorer at http://<project-id>.appspot.com/_ah/api/explorer.
http://<project-id>.appspot.com/_ah/api/explorer
For testing and debugging, you can also run your backend server locally without having to deploy your changes to the production backend. To run the backend locally, just set the value of LOCAL_ANDROID_RUN to true in CloudEndpointUtils.java in the App Engine module.
LOCAL_ANDROID_RUN
true
CloudEndpointUtils.java
Now build and run your Android app. If you called RegisterActivity from within your main activity, the device will register itself with the GCM service and the App Engine app you just deployed. If you are running the app on an emulator, note that GCM functionality requires the Google APIs Addon image, which you can download from the SDK Manager.
You can access your sample web console on any browser at http://<project-id>.appspot.com. There, you will see that the app you just started has registered with the backend. Fill out the form and send a message to see GCM in action!
http://<project-id>.appspot.com
It's easy to expand your cloud services right in Android Studio. You can add new server-side code and through Android Studio instantly generate your own custom endpoints to access those services from your Android app.
Last month, we announced Google Play for Education — a platform enabling developers and content providers to reach K-12 educators and students in the United States through a new Android based initiative. Google Play for Education is an extension of the Google Play Store for schools, adding curation, bulk purchasing, and instant distribution to students’ Android tablets for educational apps, books and videos. As we said at the time, we are excited to be doing our part to make technology and innovation in the classroom more accessible.
Starting today, you can use the Google Play Developer Console to mark your apps for inclusion in Google Play for Education, which is actively being piloted in schools across the country. Marking your app identifies it as targeted for the US K-12 educational market and queues it for evaluation by a third-party network of educators. These educators perform a first-pass qualification of apps, assigning the appropriate subject, grade, and common core standards metadata, while evaluating whether they meet the Google Play for Education criteria for classroom use.
Leading up to the fall launch, the Google Play for Education team is conducting an extensive series of pilots that include schools and students across the U.S. By marking your app for inclusion now, you will be getting your app into the hands of these schools and key influencers in the education technology community.
Whether you already have an existing educational app or are looking to build one, take a look at our Guidelines for Apps to make sure your app is appropriate for the K-12 environment. Follow our detailed requirements and test your app to ensure it is optimized for Android tablets. Then, upload your new or updated app, mark it for inclusion in Google Play for Education, and publish. We will email you when your app has been evaluated. Depending on app submission volume, this process can take 3-4 weeks. For more information, see Get Started.
Also please tune in to our panel for education developers on Tuesday June 25th at 10:30 AM EDT. Live from the ISTE (the International Society for Technology in Education) Conference, we’ll tell you more about developing for Google in Education and we’ll host some educators who explain what they are looking for in educational apps. The panel will be streamed on Google Developers Live and we'll make the video available to you as well.
For more information on Google Play for Education, please visit developer.android.com/edu.
Posted by Ellie Powers, Google Play team
Google Play gives you tons of options on publishing your apps and connecting with users. But as you get started with new features like beta testing and staged rollouts, it’s a good idea to do a checkup and make sure you’ve covered the basics.
In order to publish an update to an existing app, you’ll need to sign it with the same keystore every time. If you lose your keystore, you’ll lose your history and reviews, so you’ll need to start over with new apps with new package name and a new key, so you’ll want to make sure you protect it. First, choose a secure password, and don’t use the same password that you use for your Google account. Next, back up your keystore somewhere, but don’t upload it to Google Drive with an account you use to publish on Google Play.
As a developer, you are responsible for checking two important email addresses:
We recently launched some new guides and examples for Google Play’s Developer Program Policies and Developer Distribution Agreement. Note that once you publish an app as free, you can’t change it to a paid app later, though you can add in-app products.
You may have many people involved with your Google Play apps. Make sure roles are clear in terms of whose job it is to publish updates, check statistics and optimization tips, read and reply to user reviews, and track revenue. Make sure all of these people have the right access to the Developer Console. Many developers who are part of larger organizations also report to their larger teams about their apps’ performance. Designate someone to make sure your app description, graphics (including localized and tablet screenshots), and pricing are up to date.
To change the language you want to see the Developer Console in, set your primary language. If you speak additional languages, configure those, too — user reviews in those languages won’t be translated automatically in the Developer Console. That was a popular request from developers.
To make sure you’re aware of the latest Google Play updates for developers, make sure you check the Android Developers blog regularly, follow +Android Developers, and check the Developer Console regularly for announcements.
Many of the best mobile app experiences are powered by services in the cloud. Top Android developers such as Pulse and SongPop have long taken advantage of the convenience and scalability of Google's cloud platform in their businesses. Now with the Mobile Backend Starter, it's even easier to add cloud services to your apps.
Mobile Backend Starter is a one-click deployable, complete mobile backend that allows you to reap the benefits of a cloud backend with none of the headaches. It provides a ready-to-deploy, general purpose cloud backend and a general purpose client-side framework for Android.
Mobile Backend Starter gives you everything you need to rapidly set up a backend for your app, without needing to write any backend code. It includes a server that stores your data with App Engine and a client library and sample app for Android that make it easy to access that data. You can also add support for Google Cloud Messaging (GCM) and continuous queries that notify your app of events you are interested in. To keep user data secure, Mobile Backend Starter also includes built-in support for Google Authentication.
Features of Mobile Backend Starter include:
You can set up and run the Mobile Backend Starter in just few steps:
Consts.java
PROJECT_ID
Check out the complete docs for details on setup as well as information on how to enable authentication, send push notifications, and use standing queries.
The best part is you can download the complete source code of the backend on GitHub and customize it however you want to meet your needs.
To see Mobile Backend Starter in action, check out our talk at Google I/O 2013 (embedded below) called "From Nothing to Nirvana in Minutes: Cloud Backend for Your Android Application". The talk shows how to use Mobile Backend Starter to create a new backend server and integrate it with an Android app via Google Cloud Endpoints and the Google Plugin for Eclipse.
We look forward to hearing your questions and learning about the amazing applications you have built. You can find us lurking on the Cloud Endpoints StackOverflow forum.