gameNetwork.show do nothing

Hello, 

Ive made an app and when i want to see if the leaderboard can be shown, it do nothing. no error, no msg, only nothing.

i tried to use the sample here and change it with my values : https://docs.coronalabs.com/plugin/gameNetwork-google/

build.Lua :

[lua]

settings =

{

orientation =

{

default = “portrait”,

supported = { “portrait” }

},

android =

{

googlePlayGamesAppId = “myGoogleId”, – Your Google Play Games App Id

},

plugins =

{

– key is the name passed to Lua’s ‘require()’

[“CoronaProvider.gameNetwork.google”] =

{

– required

publisherId = “com.coronalabs”,

supportedPlatforms = { android = true }

},

},

}

[/lua]

config.lua:

[lua]

application =

{

license = {

        google = { key = “longKey”,},

    },

content =

{

width = 320,

height = 480,

scale = “letterbox”,

},

[/lua]

main.lua :

[lua]

local gameNetwork = require “gameNetwork”

local widget = require “widget”

– Init game network to use Google Play game services

gameNetwork.init(“google”)

local leaderboardId = “myLeaderboardId” – Your leaderboard id here

local achievementId = “” – Your achievement id here

– Tries to automatically log in the user without displaying the login screen if the user doesn’t want to login

gameNetwork.request(“login”,

{

userInitiated = false

})

local left = display.screenOriginX

local top = display.screenOriginY

local width = display.viewableContentWidth - display.viewableContentWidth/100

local size = display.viewableContentHeight/15

local buttonTextSize = display.viewableContentWidth/20

local topText = display.newText(system.getInfo(“appName”) … " " … system.getInfo(“build”), left, top + 20, native.systemFont, size)

topText.x = topText.x + topText.width/2

local scoreText = display.newText("Score: ", left, topText.y + topText.height, native.systemFont, size)

scoreText.x = left + scoreText.width/2

local scoreTextField = native.newTextField( display.contentCenterX, scoreText.y + scoreText.height , width - scoreText.width * 1.1, size)

scoreTextField.inputType = “number”

– Submits the score from the scoreTextField into the leaderboard

local function submitScoreListener(event)

gameNetwork.request(“setHighScore”, 

{

localPlayerScore = 

{

category = leaderboardId, – Id of the leaderboard to submit the score into

value = scoreTextField.text – The score to submit

}

})

end

local function unlockAchievementListener(event)

gameNetwork.request(“unlockAchievement”,

{

achievement = 

{

identifier = achievementId – The id of the achievement to unlock for the current user

}

})

end

local function showLeaderboardListener(event)

gameNetwork.show(“leaderboards”) – Shows all the leaderboards.

end

local function showAchievementsListener(event)

gameNetwork.show(“achievements”) – Shows the locked and unlocked achievements.

end

local loginLogoutButton

local function loginLogoutListener(event)

local function loginListener(event1)

– Checks to see if there was an error with the login.

if event1.isError then

loginLogoutButton:setLabel(“Login”)

else

loginLogoutButton:setLabel(“Logout”)

end

end

if gameNetwork.request(“isConnected”) then

gameNetwork.request(“logout”)

loginLogoutButton:setLabel(“Login”)

else

– Tries to login the user, if there is a problem then it will try to resolve it. eg. Show the log in screen.

gameNetwork.request(“login”,

{

listener = loginListener,

userInitiated = true

})

end

end

local scoreSubmitButton = widget.newButton

{

top = scoreTextField.y + scoreText.height,

left = left,

width = width,

height = size,

label = “Submit Score”,

fontSize = buttonTextSize,

onRelease = submitScoreListener,

}

local achievementSubmitButton = widget.newButton

{

top = scoreSubmitButton.y + scoreSubmitButton.height/2,

left = left,

width = width,

height = size,

label = “Unlock Achievement”,

fontSize = buttonTextSize,

onRelease = unlockAchievementListener,

}

–show leaderboard button

local showLeaderboardButton = widget.newButton

{

top = display.screenOriginY + display.viewableContentHeight/2,

left = left,

width = width,

height = size,

label = “Show Leaderboard”,

fontSize = buttonTextSize,

onRelease = showLeaderboardListener,

}

–show achievement button

local showAchievementButton = widget.newButton

{

top = showLeaderboardButton.y + showLeaderboardButton.height/2,

left = left,

width = width,

height = size,

label = “Show Achievements”,

fontSize = buttonTextSize,

onRelease = showAchievementsListener,

}

–login button

loginLogoutButton = widget.newButton

{

top = display.screenOriginY + display.viewableContentHeight - size,

left = left,

width = width,

height = size,

label = “Login”,

fontSize = buttonTextSize,

onRelease = loginLogoutListener,

}

– Checks if the auto login worked and if it did then change the text on the button

if gameNetwork.request(“isConnected”) then

loginLogoutButton:setLabel(“Logout”)

end

[/lua]

i did a little research and now, i see that my account cant log in …

and i changed the debugging sample, here is where i found the new one (ty Christopher Bishop) :

https://forums.coronalabs.com/topic/50011-resolved-gpgs-gamenetworkinit-does-nothing-with-an-error-google-play-services-resources-not-found/

Naomi,

Sample File: https://s3.amazonaws.com/example_code/GPGS.zip

 

Most of these steps are not required but since you are using messages etc. just figured I would throw them in  smile.png

 

1: In build.settings change GPGS_ID with the ID in Game Services for the app you are using.

2: From your application (in dev console) click on Services & APIS and copy your “YOUR LICENSE KEY FOR THIS APPLICATION” to config.lua->application->license->google->key->key=“YOUR_PROJECT_KEY”

3: Copy your API key from console API to config.lua->notification->google-projectNumber = “YOUR_API_PROJECT_ID”

4: Open main.lau

5: Change line 7 leaderboardId = “YOUR_LEADER_ID” to the ID that is listed in leadersboards in Game Services.

6: Change line 119 UnlockAchievement(“YOUR_ACHIEVEMENT_ID”) to any achievement ID that is listed in your Achievements.

 

Build using the product id listed in “Linked Apps” -> “com.your.productid”

 

IMPORTANT: Because Game Services will try and keep you logged in for the app you are using, goto your google device and uninstall the app before proceeding (just to make sure nothing is cached)

 

Once you have built your app, drop to command line and type 

 

adb -d install -r “C:\location\file.apk” 

 

swap out location and file for your values.

 

Once install complete open app on your device and everything should be working, tested on 4 different GPGS setups as well as creating a new one using the steps I had mentioned before.

 

 

OK NOW ON TO WHAT I FOUND.

 

First and foremost you can ignore the Google Play Resources Not Found message it is a false positive and is being caused by com.google.android.gms.common.GooglePlayServicesUtil.class which is a error in google itself and has nothing to do with corona and will not stop you from proceeding with GPGS so don’t worry about that just make sure it tests and works correctly the rest can be ignored.

 

Let me know if you have any issues.

Just out of curiosity, when you see things like:

google = { key = “longKey”,},

Are you putting your key in where it says “longKey”? There are several of these like googlePlayGamesAppId = “myGoogleId”, – Your Google Play Games App Id that needs filled out with specific information for you.

Rob

mmmmh the key i found is in services and API, the licence key product. it is the right one ? :confused:

and for the Google Play Games App Id, it is an id with 11 numbers ?

As long as you have your values and not the string “longKey”…

Rob

yes, i have all the values.

mmmmh i would like to help with some error msg but when i write adb logcat, it show everything too fast and i can only use adb logcat Corona:v *:s :confused:

i think i did a mistake with the keystore, the name package and the Signing certificate fingerprint (SHA1)

The thing is you need to look for messages from Google Play and you can’t use:  adb logcat Corona:v *:s 

You have to use adb logcat and scroll back and look for it. I wish Google would turn off all of their memory heap messages, that would help a lot.

Rob

here are the messages :

V/BaseAuthAsyncOperation(14527): access token request successful

I/System.out(14527): (HTTPLog)-Static: isSBSettingEnabled false

I/qtaguid (14527): Tagging socket 111 with tag 30b75e1c00000000{817323548,0} uid

 -1, pid: 14527, getuid(): 10017

I/qtaguid (14527): Untagging socket 111

E/Volley  (14527): [23479] BasicNetwork.performRequest: Unexpected response code

 403 for https://www.googleapis.com/games/v1/players/me?language=fr_FR

E/SignInIntentService(14527): Access Not Configured. The API (Google Play Game S

ervices API) is not enabled for your project. Please use the Google Developers C

onsole to update your configuration.

E/SignInIntentService(14527): com.google.android.gms.games.server.error.GamesExc

eption

E/SignInIntentService(14527):   at com.google.android.gms.games.server.GamesServ

oh i know why it couldnt access the google play game service, the anti-piracy was on instead of off.

but now, the token access dont work.

I/qtaguid (17876): Tagging socket 40 with tag 40100000000{1025,0} uid 10017, pid

: 17876, getuid(): 10017

I/GLSUser (17876): [GLSUser] IOException in getAuthtoken(<ELLIDED:-28026>, oauth

2:https://www.googleapis.com/auth/games) -> exception: failed to connect to andr

oid.clients.google.com/74.125.228.192 (port 443) after 30000ms: isConnected fail

ed: ECONNREFUSED (Connection refused))

I/GLSUser (17876): [GLSUser] getAuthtoken(<ELLIDED:-28026>, oauth2:https://www.g

oogleapis.com/auth/games) -> status: NETWORK_ERROR)

I/GLSUser (17876): [GLSUser] Extracting token using key: Auth

W/GLSActivity(17876): gms.StatusHelper Status from wire: NetworkError status: NE

TWORK_ERROR

V/BaseAuthAsyncOperation(14527): access token request failed

D/ChimeraCfgMgr(14527): Loading module com.google.android.gms.games from APK com

.google.android.play.games

D/ChimeraModuleLdr(14527): Module APK com.google.android.play.games already load

ed

maybe it is because im in a restricted network, i will try again at home.

nothing work, i always cant access because of the oauth2 …

then how to disable the oauth2 identification ? or how to delete the associated applications and start again without making a new project ? 

There are things as part of setting up Google Play Game Networking that are one time only things and if they are setup, all you can do is restart. Luckily you shouldn’t have to redo your entire app, but you may need to redo the entire game networking setup.

Rob

can you give me the steps to redo the entire game networking correctly, plz ?

Not really and here’s the reason.  Google changes their website periodically. They change how it looks, how things are named and the order that things are done in. They don’t tell us when they do (nor do they tell any other framework provider). We simply cannot keep documentation on how to use Apple, Google and Amazon’s portals.

There is nothing Corona specific in setting up a game for Google Play Game Services. There should be plenty of tutorials and documentation from Google on the right steps.

i finally made everything work, thank you.

now, i know how important it is the SHA1, the keystore and the package name :confused:

mmh do you know how to delete the useless linked apps ? ^^’

i did a little research and now, i see that my account cant log in …

and i changed the debugging sample, here is where i found the new one (ty Christopher Bishop) :

https://forums.coronalabs.com/topic/50011-resolved-gpgs-gamenetworkinit-does-nothing-with-an-error-google-play-services-resources-not-found/

Naomi,

Sample File: https://s3.amazonaws.com/example_code/GPGS.zip

 

Most of these steps are not required but since you are using messages etc. just figured I would throw them in  smile.png

 

1: In build.settings change GPGS_ID with the ID in Game Services for the app you are using.

2: From your application (in dev console) click on Services & APIS and copy your “YOUR LICENSE KEY FOR THIS APPLICATION” to config.lua->application->license->google->key->key=“YOUR_PROJECT_KEY”

3: Copy your API key from console API to config.lua->notification->google-projectNumber = “YOUR_API_PROJECT_ID”

4: Open main.lau

5: Change line 7 leaderboardId = “YOUR_LEADER_ID” to the ID that is listed in leadersboards in Game Services.

6: Change line 119 UnlockAchievement(“YOUR_ACHIEVEMENT_ID”) to any achievement ID that is listed in your Achievements.

 

Build using the product id listed in “Linked Apps” -> “com.your.productid”

 

IMPORTANT: Because Game Services will try and keep you logged in for the app you are using, goto your google device and uninstall the app before proceeding (just to make sure nothing is cached)

 

Once you have built your app, drop to command line and type 

 

adb -d install -r “C:\location\file.apk” 

 

swap out location and file for your values.

 

Once install complete open app on your device and everything should be working, tested on 4 different GPGS setups as well as creating a new one using the steps I had mentioned before.

 

 

OK NOW ON TO WHAT I FOUND.

 

First and foremost you can ignore the Google Play Resources Not Found message it is a false positive and is being caused by com.google.android.gms.common.GooglePlayServicesUtil.class which is a error in google itself and has nothing to do with corona and will not stop you from proceeding with GPGS so don’t worry about that just make sure it tests and works correctly the rest can be ignored.

 

Let me know if you have any issues.

Just out of curiosity, when you see things like:

google = { key = “longKey”,},

Are you putting your key in where it says “longKey”? There are several of these like googlePlayGamesAppId = “myGoogleId”, – Your Google Play Games App Id that needs filled out with specific information for you.

Rob

mmmmh the key i found is in services and API, the licence key product. it is the right one ? :confused:

and for the Google Play Games App Id, it is an id with 11 numbers ?

As long as you have your values and not the string “longKey”…

Rob

yes, i have all the values.

mmmmh i would like to help with some error msg but when i write adb logcat, it show everything too fast and i can only use adb logcat Corona:v *:s :confused:

i think i did a mistake with the keystore, the name package and the Signing certificate fingerprint (SHA1)

The thing is you need to look for messages from Google Play and you can’t use:  adb logcat Corona:v *:s 

You have to use adb logcat and scroll back and look for it. I wish Google would turn off all of their memory heap messages, that would help a lot.

Rob

here are the messages :

V/BaseAuthAsyncOperation(14527): access token request successful

I/System.out(14527): (HTTPLog)-Static: isSBSettingEnabled false

I/qtaguid (14527): Tagging socket 111 with tag 30b75e1c00000000{817323548,0} uid

 -1, pid: 14527, getuid(): 10017

I/qtaguid (14527): Untagging socket 111

E/Volley  (14527): [23479] BasicNetwork.performRequest: Unexpected response code

 403 for https://www.googleapis.com/games/v1/players/me?language=fr_FR

E/SignInIntentService(14527): Access Not Configured. The API (Google Play Game S

ervices API) is not enabled for your project. Please use the Google Developers C

onsole to update your configuration.

E/SignInIntentService(14527): com.google.android.gms.games.server.error.GamesExc

eption

E/SignInIntentService(14527):   at com.google.android.gms.games.server.GamesServ

oh i know why it couldnt access the google play game service, the anti-piracy was on instead of off.

but now, the token access dont work.

I/qtaguid (17876): Tagging socket 40 with tag 40100000000{1025,0} uid 10017, pid

: 17876, getuid(): 10017

I/GLSUser (17876): [GLSUser] IOException in getAuthtoken(<ELLIDED:-28026>, oauth

2:https://www.googleapis.com/auth/games) -> exception: failed to connect to andr

oid.clients.google.com/74.125.228.192 (port 443) after 30000ms: isConnected fail

ed: ECONNREFUSED (Connection refused))

I/GLSUser (17876): [GLSUser] getAuthtoken(<ELLIDED:-28026>, oauth2:https://www.g

oogleapis.com/auth/games) -> status: NETWORK_ERROR)

I/GLSUser (17876): [GLSUser] Extracting token using key: Auth

W/GLSActivity(17876): gms.StatusHelper Status from wire: NetworkError status: NE

TWORK_ERROR

V/BaseAuthAsyncOperation(14527): access token request failed

D/ChimeraCfgMgr(14527): Loading module com.google.android.gms.games from APK com

.google.android.play.games

D/ChimeraModuleLdr(14527): Module APK com.google.android.play.games already load

ed

maybe it is because im in a restricted network, i will try again at home.