Posted by Greg Hartrell, Senior Product Manager of Google Play Games
The Game Developers Conference (GDC) is less than one week away in San Francisco. This year we will host our annual Developer Day at West Hall and be on the Expo floor in booth #502. We’re excited to give you a glimpse into how we are helping mobile game developers build successful businesses and improve user experiences.
Our Developer Day will take place in Room 2006 of the West Hall of Moscone Center on Monday, March 2. We're keeping the content action-oriented with a few presentations and lightning talks, followed by a full afternoon of hands on hacking with Google engineers. Here’s a look at the schedule:
Opening Keynote || 10AM: We’ll kick off the day by sharing to make your games more successful with Google. You’ll hear about new platforms, new tools to make development easier, and ways to measure your mobile games and monetize them.
Running A Successful Games Business with Google || 10:30AM: Next we’ll hear from Bob Meese, the Global Head of Games Business Development from Google Play, who’ll offer some key pointers on how to make sure you're best taking advantage of unique tools on Google Play to grow your business effectively.
Lightning Talks || 11:15AM: Ready to absorb all the opportunities Google has to offer your game business? These quick, 5-minute talks will cover everything from FlatBuffers to Google Cast to data interpolation. To keep us on track, a gong may be involved.
Code Labs || 1:30PM: After lunch, we’ll turn the room into a classroom setting where you can participate in a number of self-guided code labs focused on leveraging Analytics, Google Play game services, Firebase and VR with Cardboard. These Code Labs are completely self-paced and will be available throughout the afternoon. If you want admission to the code labs earlier, sign up for Priority Access here!
Also, be sure to check out the Google booth on the Expo floor to get hands on experiences with Project Tango, Niantic Labs and Cardboard starting on Wednesday, March 4. Our teams from AdMob, AdWords, Analytics, Cloud Platform and Firebase will also be available to answer any of your product questions.
For more information on our presence at GDC, including a full list of our talks and speaker details, please visit g.co/dev/gdc2015. Please note that these events are part of the official Game Developer's Conference, so you will need a pass to attend. If you can't attend GDC in person, you can still check out our morning talks on our livestream at g.co/dev/gdc-livestream.
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.
Posted by Manfred Zabarauskas, Product Manager on Google Cloud Platform
Many Android developers like Snapchat or Pulse build and host their app backends on the Google Cloud Platform, and enjoy automatic management, with simple expansion to support millions of users.
To quickly add a Google Cloud Platform backend to your Android app, you can now use a number of built-in features in Android Studio 0.6.1+.
Google App Engine backend module templates
Google App Engine enables you to run your backend applications on Google's infrastructure, without ever requiring you to maintain any servers.
To simplify the process of adding an App Engine backend to your app, Android Studio now provides three App Engine backend module templates which you can add to your app. You can find them under "New → Module" menu:
When you choose one of these template types, a new Gradle module with your specified module/package name will be added to your project containing your new App Engine backend. All of the required dependencies/permissions will be automatically set up for you.
You can then run it locally (on http://localhost:8080) by selecting the run configuration with your backend's module name, as shown in the image below.
For more information about these backend templates, including their deployment live to App Engine and code examples which show how to connect your Android app to these backends, see their documentation on GitHub. (Also, the code for these templates lives in the same GitHub repository, so do not hesitate to submit a pull request if you have any suggestions!)
Built-in rich editing support for Google Cloud Endpoints
Once you have added the backend module to your Android application, you can use Google Cloud Endpoints to streamline the communication between your backend and your Android app. Cloud Endpoints automatically generate strongly-typed client libraries from simple Java server-side API annotations, automate Java object marshalling to and from JSON, provide built-in OAuth 2.0 support and so on.
As a concrete example, "App Engine Java Endpoints Module" contains a simple annotated Endpoints API at <backend-name>/src/main/java/<package-name>/MyEndpoint.java file (shown below):
import javax.inject.Named;
@Api(name = "myApi", version = "v1", namespace = @ApiNamespace(ownerDomain = "<package-name>", ownerName = "<package-name>", packagePath="")) public class MyEndpoint { @ApiMethod(name = "sayHi") public MyBean sayHi(@Named("name") String name) { MyBean response = new MyBean(); response.setData("Hi, " + name); return response; } }
On deployment, this annotated Endpoints API definition class generates a RESTful API. You can explore this generated API (and even make calls to it) by navigating to Endpoints API explorer as shown in the image below:
Google APIs explorer is available at http://localhost:8080/_ah/api/explorer once you deploy your app. Color overlays in this screenshot match the colors in the API snippet above (MyEndpoint.java).
To simplify calling this generated API from your Android app, Android Studio will automatically set up your project to automatically include all compile dependencies and permissions required to consume Cloud Endpoints, and will re-generate strongly-typed client libraries if your backend changes. This means that you can start calling the client libraries from your Android app immediately after defining the server-side Endpoints API:
Code completion for automatically generated, strongly-typed client libraries. Color overlays match the colors in the API snipped above (MyEndpoint.java)
As server-side Endpoints API definitions have to conform to a number of syntactic rules, Android Studio also includes a number of Endpoints-specific inspections and quick-fixes, which help you to avoid mistakes when writing Endpoints APIs.
For example, "@Named" annotation is required for all non-entity type parameters passed to server-side methods. If you forget to add this annotation when modifying sayHi method in MyEndpoint.java file, Android Studio will underline the problematic statement as-you-type:
Furthermore, to help you easily fix the problems with Cloud Endpoints, Android Studio will provide quick-fixes for the most common Cloud Endpoints development mistakes. To see these quick-fix suggestions, press Alt + Enter if you're running on Linux/Windows or ⌥ + Enter if you're running on Mac:
As expected, choosing the first quick-fix ("Add @Named") will automatically add "@Named" annotation to method's parameter, solving this problem in two key presses.
The underlying work-horses: Gradle, and Gradle plug-in for App Engine
Under the hood, Gradle is used to build both your app and your App Engine backend. In fact, when you add an App Engine backend to your Android app, an open-source App Engine plug-in for Gradle is automatically downloaded by Android Studio, and common App Engine tasks become available as Gradle targets. This allows you to use the same build system across your IDE, command-line or continuous integration environments.
For example, to deploy your backend to App Engine from Android Studio, you can launch the "appengineUpdate" task from the "Gradle tasks" tool window:
Similarly, if you want to integrate your backend's deployment into your command-line scripts, simply launch "./gradlew backend:appengineUpdate" command from your project's root directory.
Try out a codelab, or see these features live at Google I/O 2014!
If you want to give these features a spin in a more guided environment, try out our Cloud Endpoints codelab for Android. We will also be demonstrating some of these features live at Less Code, More Services, Better Android Apps session in Google I/O 2014 (as well as some of the new and even more exciting stuff), so don't forget to tune in!
We look forward to your questions or feedback, and learning about the amazing applications you have built using Android Studio and Google Cloud Platform. You can find us lurking on StackOverflow's App Engine and Cloud Endpoints forums!
Today, everyone is a gamer — in fact, 3 in every 4 Android users are playing games, allowing developers to reach an unprecedented audience of players in an Android ecosystem that’s activated over one billion devices. This has helped Google Play Games — Google’s cross-platform game service and SDK for Android, iOS and the web (which lets you easily integrate features like achievements, leaderboards, multiplayer and cloud save into your games) — grow at tremendous speed. The momentum continues on Google Play, where four times more money was paid out to developers in 2013 than in 2012.
With the Game Developers Conference (GDC) this week, we announced a number of new features for Google Play Games and other Google products. As they launch over the coming weeks, these new services and tools will help you unlock the power of Google to take your games to the next level.
Power your game and get discovered
With game gifts, players in your games can send virtual in-game objects to anyone in their circles or through multiplayer search.
To help players get the most out of your games, Play Games will be expanding engagement and discovery options.
We'll be introducing game gifts, a new service that lets players send virtual in-game objects to anyone in their circles or through player search. The Play Games app now supports multiplayer invites directly, further helping players discover your game and keep them playing. And the Google Play Store will also feature 18 new game categories, making it easier for players to find games they'll love.
Tools to take your game to the next level
Further enhancing Google Play Game services, we're expanding multiplayer to support iOS, bringing turn-based and real-time multiplayer capabilities to both Android and iOS.
To further help with cross platform game development, we're updating our Play Games Unity Plug-in to support cross-platform multiplayer services, and introducing an early Play Games C++ SDK to support achievements and leaderboards.
In addition, we're launching enhanced Play Games statistics on the Google Play Developer Console, providing easy game analytics for Play Games adopters. Developers will gain a daily dashboard that visualizes player and engagement statistics for signed in users, including daily active users, retention analysis and achievement, and leaderboard performance.
Ad features to better optimize your business
Of course, once you build a great gaming experience, it's important to get rewarded for your work, which is why we'll also be introducing new features to the AdMob platform. We're making Google Analytics available directly in the AdMob interface, so you can gain deeper insights into how users are interacting with your app. Turning those insights into effective action is vital, so we're excited by the opportunities that in-app purchase ads will offer — enabling you to target users with specific promotions to buy items in your game. Advertising continues to be a core vehicle driving many game developers' success, so we're also bringing you new ways to optimize your ads to earn the most revenue.
Watch the Google Sessions at GDC
Check out the stream from our Google Developer Day sessions at GDC 2014. Learn more about how to reach and engage with hundreds of millions of users on Google Play, build Games that scale in the cloud, grow in-game advertising businesses with AdMob, track revenue with Google Analytics, as well as explore new gaming frontiers, like Glass.
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.
Preliminary setup
Before you get started, make sure you take care of these tasks first:
Make sure you have an application project set up in Android Studio. You can use any working app that you want to integrate with your backend, even a sample app.
If you'll be running the app on an emulator, download the Google APIs Addon from the SDK Manager and run your app on that image.
Create a Google Cloud Platform project: In the Cloud Console, create a new project (or reuse an old one) and make note of the Project ID. Click on the words “Project ID” on the top left to toggle to the Project Number. Copy this as well.
Enable GCM and obtain API Key: In the Cloud Console, click on APIs and turn on the Google Cloud Messaging for Android API. Then, click on the “Register App” button on the top left, enter a name for the app, then select “Android” and “Accessing APIs via a web server”. In the resulting screen, expand the “Server Key” box and copy the API key.
1. Generate an App Engine project
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:
An App Engine project which contains the backend application source
An endpoints module with a RegisterActivity class, related resources, and client libraries for the Android app to communicate with the backend
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:
A Google Cloud Endpoint (DeviceInfoEndpoint.java, auto-generated from DeviceInfo.java) that your Android app will “register” itself through. Your backend will use that registration info to send a push notification to the device.
A sample endpoint, MessageEndpoint.java, to list previously sent GCM messages and send new ones.
A starter web frontend application (index.html in webapp directory) that will show all the devices that have registered with your service, and a form to send them a GCM notification.
The endpoints module (<app_name>-endpoints) generated for you contains the classes and libraries needed by the Android application to interact with the backend:
A RegisterActivity.java class that, when invoked, will go through the GCM registration flow and also register itself with the recently created backend through DeviceInfoEndpoint.
Client libraries, so that the application can talk to the backend using an object rather than directly using raw REST calls.
XML files related to the newly created activity.
2. Add GCM registration to your app
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.
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.
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.
4. Build and run the Android app
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!
Extending the basic setup
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.
Posted by Brad Abrams, Product Manager, Google Cloud Platform
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
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:
Cloud data storage: Users change devices and increasingly use multiple devices. Store any amount of data per user in the cloud to be accessed from anywhere.
Pub/Sub messaging: Send messages from one device, to any or all other devices. You can easily use 1:1 and 1:many messaging as well as broadcasting. This feature is useful for various applications including social apps, forums, chat, gaming, and group collaborations.
Push notifications: Data updated on one device is automatically available on all devices with GCM for Android.
Continuous queries: Create queries that run continuously on the server, automatically feeding updates to the client. These queries are powered by Prospective Search.
Google authentication and authorization: Keep data isolated per user or shared among users.
Free to get started, scales with your needs: You can start by handling hundreds of users for free, then grow to any scale.
Quick setup and integration
You can set up and run the Mobile Backend Starter in just few steps:
Click on Settings to go to the admin control panel for your new backend. Under Authentication / Authorization, select "Open (for development use only)" and save the changes.
Next, download the Android client project and open it up in your Android IDE. Locate the Consts.java file and set the PROJECT_ID to the Project ID of the project you created in the Google Cloud Console.
Now just build and run the Android application and you have a cloud enabled Android application.
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.
See Mobile Backend Starter in action at Google I/O
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.