steeveesas
steeveesas

Reputation: 77

App Engine and Google Game Services clientId collision

I am going to try to make this question more concise and understandable than my original post.
I have an android app where I want to use Google Game Services to record achievements and leader board information and App Engine to store user data and game information.
Each of these work individually, but I can't get them working together.

When I create my Google Game Services linked apps through the developer console the clientIds are registered and visible in the developer console as well as the cloud console.

So at this point I have 2 projects in my cloud console, one for Game Services and one for App Engine.

But when I try to create those same clientIds with my android app's package name and SHA cert fingerprint for my app engine project in cloud console I get an error stating that that particular clientId is already in use. The same thing happens when I try to create the clientIds in the App Engine cloud console project first and then add them in the Game Services developer console.

Is there a way to have an Android app that uses both App Engine and Game Services?

Upvotes: 3

Views: 373

Answers (2)

Roel
Roel

Reputation: 3096

When you have to authorise your game after adding a new game at the GameServices tab in the Google Play Developer console you can select an existing API. They the clientID's will be added to your existing Google Console Project.

In your Android app you can use the selected accountname for Game Services to login to your App Engine. If your Activity extends BaseGameActivity get the selected accountname like this:

Plus.AccountApi.getAccountName(getApiClient())

Upvotes: 0

steeveesas
steeveesas

Reputation: 77

I figured this out. It turns out to be much simpler than I was making it which became evident once I went back to square one.

Here's how you can do this.
Set up an app engine project in the cloud console. For Cloud Endpoints with Android you need to create an Android clientId and a Web clientId. But don't create the Android clientId yet, it will be created through the developer console later. Creating the Web clientId is okay at this time if you want, or you can do it later.

Now go to the Developer Console -> Game Services -> Add a new game.

Make sure you click the tab "I already use Google API's in my Game". Now you will be able to link this new Game to your app engine project. (This is what I missed having already created a Game through the developer console and not revisiting this step in the process until just now).

Now you can follow the rest of the instructions on

https://developers.google.com/games/services/console/enabling

When you create a clientId through the developer console for your Game Services game it will also show up in the cloud console.

You can then use this as your Android ClientId in your endpoints code ( this is why you didn't create the Android ClientId up above ).

If you didn't already create your Web clientId that endpoints needs for Android clients then do so now.

You should be able to make calls to game services from your android application and to app engine from your android application.

Upvotes: 1

Related Questions