gpgs.getAccountName not responding

Hi everyone,

I have the code below setup to log in to gpgs and I am trying to pull in the account name so I have a unique identifier for the client that is tied to their gpgs account.

_ local loggedintogpgs = 0; _

_ local accountname = “”; _

function gpgsGetAccountNameListener ( event )

_ infopopup.InfoPopup:create _

_ _

title=“gpgsGetAccountNameListener() callback”, 

_ lines= _

_ { _

json.prettify(event)

_ _

}:display() 

_     if not event.isError then _

_ – Do account name stuff _

_ accountname = event.accountName; _

_ end _

_ end _

gpgsLoginListener = function ( event )

_     if not event.isError then _

_ if loggedintogpgs==0 then _

_ loggedintogpgs=1 _

gpgs.getAccountName( gpgsGetAccountNameListener )

_ end _

_ end _

_ end _

gpgsInitListener = function ( event )

_     if not event.isError then _

gpgs.login( { userInitiated=true, listener=gpgsLoginListener } )

_ end _

_ end _

gpgs.init( gpgsInitListener )

Everything above works fine except that the callback to _ gpgsGetAccountNameListener   _never happens and I can’t seem to figure out why, and I do believe my permissions are setup with the following:

_ _

_ – Android section _

_ _

_ android = _

_ { _

_   googlePlayGamesAppId = “XXXXXXXXXX”, _

_   usesPermissions = _

_   { _

_     “android.permission.INTERNET”, _

_     “android.permission.GET_ACCOUNTS” _

_   }, _

_ }, _

Does anyone have experience using the gpgs.getAccountName function? Or is there some other preferred way to pull in the users account name?

Cheers ~

What version are you using? Please make sure you are using the v2 version here:

http://docs.coronalabs.com/plugin/gpgs-v2/index.html

Yes, I am using v2, I’m quite certain that is not the issue but thank you.

Is the playerId and display name enough? I know those work because I use them.

gpgs.players.load(googlePlayServicesListerner) -- loads the current player

and then:

local playerDisplayName = event.players[1].name local playerId = event.players[1].id

Thanks for the reply, I am not entirely sure what happened, I didn’t change my code at all and all of the sudden it started working just fine, so I guess I should be able to use this as a solution.

What version are you using? Please make sure you are using the v2 version here:

http://docs.coronalabs.com/plugin/gpgs-v2/index.html

Yes, I am using v2, I’m quite certain that is not the issue but thank you.

Is the playerId and display name enough? I know those work because I use them.

gpgs.players.load(googlePlayServicesListerner) -- loads the current player

and then:

local playerDisplayName = event.players[1].name local playerId = event.players[1].id

Thanks for the reply, I am not entirely sure what happened, I didn’t change my code at all and all of the sudden it started working just fine, so I guess I should be able to use this as a solution.