hey guys i am having a little trouble with implementing a leaderboard in my game i am working on i followed this tutorial http://www.coronalabs.com/blog/2013/06/25/tutorial-introducing-google-play-game-services/ when i first load the app on my samsug note 2 it ask for my to log in, i went a head and log in but i wind up with a blank screen. i was wondering if i have to publish the leaderboard in order for it to show up in my app or i am doing something wrong can someone help please i would appreciate it thanks
can someone please help thank you :( am i doing something wrong i am using the same code from the article.
local gameNetwork = require( "gameNetwork" ) local playerName local function loadLocalPlayerCallback( event ) playerName = event.data.alias saveSettings() --save player data locally using your own "saveSettings()" function end local function gameNetworkLoginCallback( event ) gameNetwork.request( "loadLocalPlayer", { listener=loadLocalPlayerCallback } ) return true end local function gpgsInitCallback( event ) gameNetwork.request( "login", { userInitiated=true, listener=gameNetworkLoginCallback } ) end local function gameNetworkSetup() if ( system.getInfo("platformName") == "Android" ) then gameNetwork.init( "google", gpgsInitCallback ) else gameNetwork.init( "gamecenter", gameNetworkLoginCallback ) end end ------HANDLE SYSTEM EVENTS------ local function systemEvents( event ) print("systemEvent " .. event.type) if ( event.type == "applicationSuspend" ) then print( "suspending..........................." ) elseif ( event.type == "applicationResume" ) then print( "resuming............................." ) elseif ( event.type == "applicationExit" ) then print( "exiting.............................." ) elseif ( event.type == "applicationStart" ) then gameNetworkSetup() --login to the network here end return true end Runtime:addEventListener( "system", systemEvents ) -- leader board local function showLeaderboards( event ) if ( system.getInfo("platformName") == "Android" ) then gameNetwork.show( "leaderboards" ) else gameNetwork.show( "leaderboards", { leaderboard = {timeScope="AllTime"} } ) end return true end local function postScoreSubmit( event ) --whatever code you need following a score submission... return true end local myScore = 100 --for GameCenter, default to the leaderboard name from iTunes Connect local myCategory = "com.yourname.yourgame.highscores" if ( system.getInfo( "platformName" ) == "Android" ) then --for GPGS, reset "myCategory" to the string provided from the leaderboard setup in Google myCategory = "CgkJtbq23agVEAIQAQ" end gameNetwork.request( "setHighScore", { localPlayerScore = { category=myCategory, value=tonumber(myScore) }, listener = postScoreSubmit } ) -- showing awards local function showAchievements( event ) gameNetwork.show( "achievements" ) return true end --for GameCenter, default to the achievement name from iTunes Connect local myAchievement = "com.yourname.yourapp.achivementname" if ( system.getInfo("platformName") == "Android" ) then --for GPGS, reset "myAchievement" to the string provided from the achievement setup in Google myAchievement = "CgkIsqa23agVEAIQAg" end gameNetwork.request( "unlockAchievement", { achievement = { identifier=myAchievement, percentComplete=100, showsCompletionBanner=true }, listener = achievementRequestCallback } )
What error messages are you getting in your device’s log (adb logcat)?
How would I go about finding the logcat since the apis don’t work on the corona sdk simulator??
We have a tutorial for that:
http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/
Thanks
Rob
Okay Rob I will look at getting the error message and post it thanks for help
WARNING: The ‘gameNetwork’ library is not available on this platform.
WARNING: The ‘gameNetwork’ library is not available on this platform.
WARNING: The ‘gameNetwork’ library is not available on this platform.
systemEvent applicationStart
WARNING: The ‘gameNetwork’ provider (gamecenter) is not available on the simulator
Rob i downloaded a IDE and the log hat was blank but the corona sdk console spit this above i don’
t understand what this problem is ? :)
startup, version: 2221 windows x64 channel: stable executable: /C/Program Files/Sublime Text 2/sublime\_text.exe working dir: /C/Users/progammer/Desktop packages path: /C/Users/progammer/AppData/Roaming/Sublime Text 2/Packages settings path: /C/Users/progammer/AppData/Roaming/Sublime Text 2/Settings PackageSetup not required Py\_GetProgramName(): sublime\_text.exe Py\_GetExecPrefix(): C:\Program Files\Sublime Text 2 Py\_GetProgramFullPath(): C:\Program Files\Sublime Text 2\sublime\_text.exe Py\_GetPath(): C:\Program Files\Sublime Text 2\python26.zip;C:\Program Files\Sublime Text 2\DLLs;C:\Program Files\Sublime Text 2\lib;C:\Program Files\Sublime Text 2\lib\plat-win;C:\Program Files\Sublime Text 2\lib\lib-tk;C:\Program Files\Sublime Text 2 Py\_GetPythonHome(): C:\Program Files\Sublime Text 2 catalogue loaded found 5 files for base name Default.sublime-keymap found 1 files for base name Default.sublime-mousemap found 2 files for base name Main.sublime-menu Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\CSS\css\_completions.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Corona Editor\completions.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Corona Editor\corona\_docs.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\comment.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\copy\_path.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\delete\_word.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\detect\_indentation.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\duplicate\_line.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\echo.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\exec.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\fold.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\font.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\goto\_line.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\indentation.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\kill\_ring.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\mark.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\new\_templates.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\open\_file\_settings.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\open\_in\_browser.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\paragraph.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\save\_on\_focus\_lost.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\scroll.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\set\_unsaved\_view\_name.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\side\_bar.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\sort.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\swap\_line.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\switch\_file.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\transform.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\transpose.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Default\trim\_trailing\_white\_space.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Diff\diff.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\HTML\encode\_html\_entities.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\HTML\html\_completions.py Reloading plugin C:\Users\progammer\AppData\Roaming\Sublime Text 2\Packages\Package Control\Package Control.py plugin init time: 1.19319 loading bindings loading pointer bindings found 1 files for base name Default.sublime-theme theme loaded app ready pre session restore time: 2.49749 wrote startup cache, added files: 4 orphaned files: 0 total files: 97 cache hits: 93 startup time: 2.84828 (package setup was not run) loaded 866 snippets Writing file /C/Users/progammer/Documents/Corona Projects/leader bord/main.lua with encoding UTF-8 Package Control: No updated packages Running Corona Simulator.exe -singleton -no-console C:\Users\progammer\Documents\Corona Projects\leader bord\main.lua
hey guys i am not sure if this will help
The first log you posted is from your computer, not your device. The second one is from Sublime Text, which again, is from your computer not your device.
You have to install the “Android Debug Bridge” tools, known as “adb”. Then you hook your phone or tablet to your computer via it’s USB cable and from the command terminal you execute the command:
adb logcat
It’s this information we need. These services do not work in the simulator and have to be tested on device and we need to device’s information to see what’s going on. The blog post I gave you above should have all the steps in it you need to get to this log information.
Rob
okay Rob i will go head and do that and post the log hat as soon as possible, sorry for posting the sublime i thought it would help, thanks for your help
hey Sorry for taking so long ,i had a little or truble with my samsung drive for my Note, but i finally found you how to debuge my corona apps the right way. now heres the log cat for this probelm
C:\Users\progammer\Documents\app progammer box\android sdk\platform-tools\>adb lo gcat Corona:v \*:s \* daemon not running. starting it now on port 5037 \* \* daemon started successfully \* --------- beginning of /dev/log/system --------- beginning of /dev/log/main V/Corona (14488): \> Class.forName: network.LuaLoader V/Corona (14488): \< Class.forName: network.LuaLoader V/Corona (14488): Loading via reflection: network.LuaLoader V/Corona (14488): \> Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona (14488): \< Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona (14488): Loading via reflection: CoronaProvider.licensing.google.LuaLo ader I/Corona (14488): WARNING: The 'gameNetwork' library is not available on this p latform. I/Corona (14488): WARNING: The 'gameNetwork' library is not available on this p latform. I/Corona (14488): WARNING: The 'gameNetwork' library is not available on this p latform. I/Corona (14488): systemEvent applicationStart V/Corona (14488): \> Class.forName: CoronaProvider.gameNetwork.google.LuaLoader V/Corona (14488): \< Class.forName: CoronaProvider.gameNetwork.google.LuaLoader V/Corona (14488): Loading via reflection: CoronaProvider.gameNetwork.google.Lua Loader I/Corona (14488): systemEvent applicationSuspend I/Corona (14488): suspending........................... I/Corona (14488): systemEvent applicationResume I/Corona (14488): resuming............................. C:\Users\progammer\Documents\app progammer box\android sdk\platform-tools\>
can someone help thanks
I don’t see anything there that should black screen you. Though I’m curious as to why your device thinks that the gameNetwork isn’t available.
i am not sure why it is saying that but is there any sample code that could help my though this i try this code here https://github.com/coronalabs/plugins-sample-gameNetwork-google/blob/master/main.lua and i build it with my google play info and it it crash on my phone. but is there any good sample code that could help me around this problem. also i haven been looking at the play together plugin for corona it look pretty scary when it comes on to the leader board. thank rob far you help so for you a life saver bro
Can you run adb logcat without the Corona:v *:s ?? When you include that, you are filtering out any message that Corona itself doesn’t print. In this case, your app is talking to the Google Play app and it may be spewing errors.
We did a blog post/tutorial on GPGS that might give you some insite:
http://www.coronalabs.com/blog/2013/06/25/tutorial-introducing-google-play-game-services/
Rob
i tried that but i it endlessly print code, do you want me to stop the endless print out and post what it printed out ?
No, I want you to look through there for something that looks like an error from Google Play around the time your app crashes. I find it best to kind of let your device stop spewing data (from all of those alloc’s ) and when it calms down, do what you do to trigger the error and capture that last little bit before the OS starts spewing again.
Rob
hey rob remember that sample code that i told you about that crash every second i build it and use the corona debugger and it printed out this
C:\Users\progammer\Documents\app progammer box\android sdk\platform-tools\> Coron a:v \*:s The filename, directory name, or volume label syntax is incorrect. C:\Users\progammer\Documents\app progammer box\android sdk\platform-tools\>adb lo gcat Corona:v \*:s --------- beginning of /dev/log/system --------- beginning of /dev/log/main V/Corona (24446): \> Class.forName: network.LuaLoader V/Corona (24446): \< Class.forName: network.LuaLoader V/Corona (24446): Loading via reflection: network.LuaLoader V/Corona (24446): \> Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona (24446): \< Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona (24446): Loading via reflection: CoronaProvider.licensing.google.LuaLo ader V/Corona (24446): \> Class.forName: CoronaProvider.gameNetwork.google.LuaLoader V/Corona (24446): \< Class.forName: CoronaProvider.gameNetwork.google.LuaLoader V/Corona (24446): Loading via reflection: CoronaProvider.gameNetwork.google.Lua Loader V/Corona (25100): \> Class.forName: network.LuaLoader V/Corona (25100): \< Class.forName: network.LuaLoader V/Corona (25100): Loading via reflection: network.LuaLoader V/Corona (25100): \> Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona (25100): \< Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona (25100): Loading via reflection: CoronaProvider.licensing.google.LuaLo ader V/Corona (25100): \> Class.forName: CoronaProvider.gameNetwork.google.LuaLoader V/Corona (25100): \< Class.forName: CoronaProvider.gameNetwork.google.LuaLoader V/Corona (25100): Loading via reflection: CoronaProvider.gameNetwork.google.Lua Loader
but the app still crash
okay i look though the code and see what happens when it crashes
can someone please help thank you :( am i doing something wrong i am using the same code from the article.
local gameNetwork = require( "gameNetwork" ) local playerName local function loadLocalPlayerCallback( event ) playerName = event.data.alias saveSettings() --save player data locally using your own "saveSettings()" function end local function gameNetworkLoginCallback( event ) gameNetwork.request( "loadLocalPlayer", { listener=loadLocalPlayerCallback } ) return true end local function gpgsInitCallback( event ) gameNetwork.request( "login", { userInitiated=true, listener=gameNetworkLoginCallback } ) end local function gameNetworkSetup() if ( system.getInfo("platformName") == "Android" ) then gameNetwork.init( "google", gpgsInitCallback ) else gameNetwork.init( "gamecenter", gameNetworkLoginCallback ) end end ------HANDLE SYSTEM EVENTS------ local function systemEvents( event ) print("systemEvent " .. event.type) if ( event.type == "applicationSuspend" ) then print( "suspending..........................." ) elseif ( event.type == "applicationResume" ) then print( "resuming............................." ) elseif ( event.type == "applicationExit" ) then print( "exiting.............................." ) elseif ( event.type == "applicationStart" ) then gameNetworkSetup() --login to the network here end return true end Runtime:addEventListener( "system", systemEvents ) -- leader board local function showLeaderboards( event ) if ( system.getInfo("platformName") == "Android" ) then gameNetwork.show( "leaderboards" ) else gameNetwork.show( "leaderboards", { leaderboard = {timeScope="AllTime"} } ) end return true end local function postScoreSubmit( event ) --whatever code you need following a score submission... return true end local myScore = 100 --for GameCenter, default to the leaderboard name from iTunes Connect local myCategory = "com.yourname.yourgame.highscores" if ( system.getInfo( "platformName" ) == "Android" ) then --for GPGS, reset "myCategory" to the string provided from the leaderboard setup in Google myCategory = "CgkJtbq23agVEAIQAQ" end gameNetwork.request( "setHighScore", { localPlayerScore = { category=myCategory, value=tonumber(myScore) }, listener = postScoreSubmit } ) -- showing awards local function showAchievements( event ) gameNetwork.show( "achievements" ) return true end --for GameCenter, default to the achievement name from iTunes Connect local myAchievement = "com.yourname.yourapp.achivementname" if ( system.getInfo("platformName") == "Android" ) then --for GPGS, reset "myAchievement" to the string provided from the achievement setup in Google myAchievement = "CgkIsqa23agVEAIQAg" end gameNetwork.request( "unlockAchievement", { achievement = { identifier=myAchievement, percentComplete=100, showsCompletionBanner=true }, listener = achievementRequestCallback } )
What error messages are you getting in your device’s log (adb logcat)?
How would I go about finding the logcat since the apis don’t work on the corona sdk simulator??