[ANDROID] Google Play Achievements on unlock not appearing!

Anything libgdx related goes here!

[ANDROID] Google Play Achievements on unlock not appearing!

Postby seethree » Tue Feb 27, 2018 11:08 am

I've created a mAchievementsClient based off the android sample code i found in github: https://github.com/playgameservices/and ... ic-samples

I have leaderboard and sign in working correctly. Except when I unlock an achievement in my game the popup doesnt appear on the screen, but does unlock when I check the screen. My sign in client looks like this:

Code: Select all
mGoogleSignInClient = GoogleSignIn.getClient(androidLauncher,
                new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN).build());


after a successful login I grab the achievement client:

Code: Select all
mAchievementsClient = Games.getAchievementsClient(this, googleSignInAccount);


this is the AndroidLauncher class and it does implement an interface to the core code. I only have one achievement at the moment that unlocks when the player finishes a game

Code: Select all
public void unlockAchievementFirstGame() {
    mAchievementsClient.unlock(androidLauncher.getString(R.string.achievement_first_game));
}


But I don't get a notification on the screen when the first unlock happens! Can anyone help?
seethree
 
Posts: 1
Joined: Tue Feb 27, 2018 10:58 am

Re: [ANDROID] Google Play Achievements on unlock not appeari

Postby antony_hg » Fri Aug 10, 2018 12:01 am

i face the same issue, have you solved the problem yet?
antony_hg
 
Posts: 27
Joined: Mon Aug 10, 2015 6:37 pm

Re: [ANDROID] Google Play Achievements on unlock not appeari

Postby RocketScienceGamer » Fri Aug 10, 2018 11:28 pm

Hi,

I was able to solve this by doing following code which needs to be called once you are signed into Google Play services (note specially "android.R.id.content" in the call to setViewForPopups):

gamesClient = Games.getGamesClient(this, GoogleSignIn.getLastSignedInAccount(this));
gamesClient.setViewForPopups(findViewById(android.R.id.content));
gamesClient.setGravityForPopups(Gravity.TOP | Gravity.CENTER_HORIZONTAL);

Let me know if it works for you :)

Kind Regards,

Arsalan
---------------
I just launched my puzzle game with 5000+ unique challenging puzzles. I will appreciate if you give it a try and provide feedback.

Google PlayStore: https://play.google.com/store/apps/deta ... c.numbergo
iOS AppStore: https://itunes.apple.com/us/app/number-go/id1397150553
FACEBOOK: https://www.facebook.com/NumberGo/
RocketScienceGamer
 
Posts: 5
Joined: Sat Jul 07, 2018 7:32 pm

Re: [ANDROID] Google Play Achievements on unlock not appeari

Postby antony_hg » Sun Aug 12, 2018 12:15 am

RocketScienceGamer wrote:Hi,

I was able to solve this by doing following code which needs to be called once you are signed into Google Play services (note specially "android.R.id.content" in the call to setViewForPopups):

gamesClient = Games.getGamesClient(this, GoogleSignIn.getLastSignedInAccount(this));
gamesClient.setViewForPopups(findViewById(android.R.id.content));
gamesClient.setGravityForPopups(Gravity.TOP | Gravity.CENTER_HORIZONTAL);

Let me know if it works for you :)

Kind Regards,

Arsalan
---------------
I just launched my puzzle game with 5000+ unique challenging puzzles. I will appreciate if you give it a try and provide feedback.

Google PlayStore: https://play.google.com/store/apps/deta ... c.numbergo
iOS AppStore: https://itunes.apple.com/us/app/number-go/id1397150553
FACEBOOK: https://www.facebook.com/NumberGo/


it worked, thank you very much
antony_hg
 
Posts: 27
Joined: Mon Aug 10, 2015 6:37 pm


Return to Libgdx

Who is online

Users browsing this forum: shatterblast and 1 guest