[Solved] can we integrate google play services (game center ) in cocos2d-x ios and android game in xcode

can we integrate google play services (game center ) in cocos2d-x ios game in xcode

Game Center: Yes
Google Play Services: Yes

@lance_gray can u please provide me with a link that has proper steps to integrate google game services in my IOS cocos2dx game

I already linked it on my first reply: https://developers.google.com/games/services/ios/quickstart

You just need a wrapper C++ class that calls Obj-C functions, which calls Google Play API functions.

Hi I’m working on this https://github.com/cpinan/Cocos2dX_GooglePlayGamesServices Yesterday I implement Google Play Game Services with IOS and well on Android some months ago. I let a template that work with both platforms.

Maybe can help you.

2 Likes

@cpinan thank u so much brother… It worked for me.Now I have integrated it in my game.Thanks once again

1 Like

@rajan I feel happy for help you =D. I’m still working on that template and the next week I will add AdMob Integration for ios an android.

@cpinan wow thats great…You are really helping cocos2dx users…I appreciate your efforts

cool… will admob integration work on 2.2.3 also??

@cpinan wrote:

Hi I’m working on this https://github.com/cpinan/Cocos2dX_GooglePlayGamesServices Yesterday I implement Google Play Game Services with IOS and well on Android some months ago. I let a template that work with both platforms.

Maybe can help you.

Thanks and I am able to run sample project in Android.
However, how do we add it to our existing project? I copy the java files and got lots of errors in eclipse, saying that R cannot be resolved to a variable, blah blah blah

@winipcfg You have to change the name of the package and import that package of what you are using because you have encountered R errors which means the project is not getting the right path of where the resources are

Thanks. Now I am able to copy the files and run HelloWorldScene in my project.

I have one more question. I run the sample project on a physical Android device. At the beginning I found that the screen is flickering during login.
The screen returns normal after an error popup (for incorrect sign-in) is displayed. Will it be solved after I setup the service configuration correctly? Thanks.

Edited: Found a solution and fixed (http://www.cocos2d-x.org/forums/6/topics/34686)

@winipcfg i also experienced the same problem and did the fix as mentioned above…but what if the net is very slow and trying to connect. In my case the net is continuously trying to connect.When I press back key the account screen come and then i click on cancel.But still i cant touch any of my cocos2dx button there and the screen view is still on google.How can i solve that problem. I just want a timeout if net doesnt connect in 10 seconds.

Hi again. I’m working on that issue on Android (the screen blinking when the app is executed by first time) Really I’m not sure what is happening but I’m working.

And I added admob for Android and IOS in the next days I’ll push a new version on my github.


Thanks @winipcfg Now it’s already fixed. I follow this thread: https://github.com/cocos2d/cocos2d-x/pull/5320 and I already fix.

On “Cocos2dxGLSurfaceView.java”

Change and put:

@Override
public void onResume() {
	super.onResume();

	this.setRenderMode(RENDERMODE_CONTINUOUSLY);

	this.queueEvent(new Runnable() {
		@Override
		public void run() {
			Cocos2dxGLSurfaceView.this.mCocos2dxRenderer.handleOnResume();
		}
	});
}

@Override
public void onPause() {

	this.queueEvent(new Runnable() {
		@Override
		public void run() {
			Cocos2dxGLSurfaceView.this.mCocos2dxRenderer.handleOnPause();
		}
	});

	this.setRenderMode(RENDERMODE_WHEN_DIRTY);

	// super.onPause();
}

I recently (Minutes ago xD) added a new version with the screen flickering fixed and AdMob integration for IOS and Android.

Check Readme for more information.

@cpinan great work brother.thank you for all your help and efforts.I appreciate…

Why not use this project: Google Play Games C++ SDK ?

@morrowyn wrote:

Why not use this project: Google Play Games C++ SDK ?

https://developers.google.com/games/services/cpp/GettingStartedNativeClient

wow, it looks great. (!)
Last time I check out the web and it only allow us to work with java/objc

@morrowyn this c++ sdk has limited features
Currently, the SDK implements the following services:

Authorization
Achievements
Leaderboards

whereas if we go by native it provides us with many more features

I read this week about the Google Play Game C++ SDK but my next integration will be multiplayer feature for Android and IOS. Currently I’m testing first on Android (I know Android but IOS well… I’m learning IOS xD) and after the IOS integration.

When I finish I’ll push a new commit on my github.