Saturday, 24 August 2013

how to connect to google play service and load leaderboard

how to connect to google play service and load leaderboard

I want to connect my game with google play service. i have read
documentation on android developer and try to following type-a-number
sample and still can't load leaderboard.
i have import baseGameUtils, but i use andengine so i didn't use extends
BaseGameActivity from google.
what i have until now:
- GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) return success
- startActivityForResult(pickAccountIntent, REQUEST_CODE_PICK_ACCOUNT); is
working well and i got my account name from onActivityResult(..);
- i already put this on my manifest.
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />
my questions are
1. can i use google play service without extends BaseGameActivity?
2. if i use gameHelper.beginUserInitiatedSignIn(); after i got my account
name, i got this on log cat. (what this connected mean? because i still
got error on next question)
08-25 00:09:01.890: D/BaseGameActivity(11222):
isGooglePlayServicesAvailable returned 0
08-25 00:09:01.890: D/BaseGameActivity(11222): beginUserInitiatedSignIn:
starting new sign-in flow.
08-25 00:09:01.890: D/BaseGameActivity(11222): All clients now connected.
Sign-in successful.
08-25 00:09:01.890: D/BaseGameActivity(11222): All requested clients
connected. Sign-in succeeded!
3 . how do i use connect()? i have read and tried about gameClient and
GameClientBuilder but i have no idea how to use that. when i tried run
this code.
startActivityForResult(gameHelper.getGamesClient().getAllLeaderboardsIntent(),
RC_UNUSED);
i got this log.
08-25 00:09:05.660: E/AndroidRuntime(11222):
java.lang.IllegalStateException: Not connected. Call connect() and wait
for onConnected() to be called.
4 . to use leaderboard i know i must use code from google play store such
as CgkIx****AIQAA. but i didn't found where i must put this code to load
leaderboard.
sorry for long question, but i think if there is a sample that only for
connect and either access achievement or leaderboard it will answer all my
question. please don't tell me to see type-a-number sample, i did that and
i need another sample code.

No comments:

Post a Comment