brother i tried implementing your code. it runs fine except one function.
its giving an error
“The method setResultCallback(ResultCallback<Players.LoadPlayersResult>) in the type PendingResult<Players.LoadPlayersResult> is not applicable for the arguments (new ResultCallback<Players.LoadPlayersResult>(){})”
on load friends function,
and in same function there is another error for (Player friend : mFriends(it gives erros on mFriends)
“Type mismatch: cannot convert from element type Object to Player”.
kindly help me out i will be really very thankful to you
Thanks for your post, but can you tell about how doing that in VS?
What about in Visual studio? Thanks
U have load the library more than one time.
Try to remove the library (Cocos2d-x…java/srcx). If not mistaken, it at property - Java build path - source.
As I know, it support Eclipse in Android platform. I don’t know it can support VS Windows Phone platform.
We recently launched a tutorial on Android setup with a iOS version coming today/tomorrown
http://www.sonarlearning.co.uk/questions.php?question-topic=32
Thanks, I’ll check it out.
MichaelContento:
Hi,
I’ve only used the leadboard and achievement part of the Google Play Games Service and a proper documentation for the whole thing is missing too but … maybe this is interesting for you guys?
Feel free to ask if anything is unclear
Can you refresh address to file GameCenter.java, it’s dead. Can explain about what are those files doing in the whole process? Thanks
@MichaelContento can I test this on windows or I have to run in ADV?
Thanks explosis, now I know how to do that.
explosis:
Here’s what I did:
Setup your app on the Google Play Game Services console like the guide from google says. Record the id of your app after creation
Download the BasicGameUtils project that google provides for doing a lot of the game services operations.
Now go into your project
Add android-support-v4.jar and google-play-services.jar to your libs directory. android-support can be found in the BasicGameUtils project and google-play-services.jar is in
your android sdk/extras/google directory (This should have been downloaded via the Android SDK Manager)
Edit AndroidManifest.xml and add <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="
string/app_id" />@ to the application section.
Edit your res/values/strings.xml and add <string name="app_id">xxxxxxxxxxx</string>
with the id you recorded from above
Go into your /src/com/company/appname/ directory and add two files, BaseGameActivity.java and GameHelper.java. Copy the code for each of those from the BaseGameUtils classes,
BasgeGameActivity and GameHelper.
Change the package names on your new BaseGameActivity and GameHelper and fix any other imports that aren’t resolving
Change
public abstract class BaseGameActivity extends FragmentActivity implements
to
public abstract class BaseGameActivity extends Cocos2dxActivity implements
in BaseGameActivity.java
Do these steps in your appname.java file:
Change public class appname extends Cocos2dxActivity
to public class appname extends BaseGameActivity
Add static Context mContext
near the top if you haven’t already
Add mContext = appname.this;
in your onCreate
Add these new methods to appname.java:
public static void gameServicesSignIn() {
((appname)mContext).runOnUiThread(new Runnable() {
public void run() {
((appname)mContext).beginUserInitiatedSignIn();
}
});
}
public static void updateTopScoreLeaderboard(int score) {
((appname)mContext).getGamesClient().submitScore("leaderboardid",
score);
}
public static void updateAchievement(String id, int percentage) {
((appname)mContext).getGamesClient().incrementAchievement(id,percentage);
}
public static void showLeaderboards() {
((appname)mContext).runOnUiThread(new Runnable() {
public void run() {
((appname)mContext).startActivityForResult(((appname)mContext).getGamesClient().getLeaderboardIntent("leaderboardidfromgoogleplay"), 5001);
}
});
}
public static void showAchievements() {
((appname)mContext).runOnUiThread(new Runnable() {
public void run() {
((appname)mContext).startActivityForResult(((appname)mContext).getGamesClient().getAchievementsIntent(), 5001);
}
});
}
These new methods are going to be called via JNI to do their various operations.
Now go into your C*+ Scene code and make the JNI calls to these new methods. If you haven’t done JNI before, you can look at the SimpleAudioEngine JNI classes for examples on how to do this.
For me, I created a new C*+ helper class that only makes calls to static methods in my appname.java
This is pretty rough but it should get you started. Someone else could probably make some better Helper classes to encapsulate all of this logic.