LeaderBoard not showing up! (Google)

Dear All,

I believe I have implemented the code correctly and I have also set up the leaderboards on my dev account. However, I’m wondering why my leaderboard will not show up at all? Here is my code:

Menu.lua: ( the print works when button is pressed but the leaderboard wont show.)

function handleButtonEvent1( event ) if ( "ended" == event.phase ) then print("button pressed for leaderboard") if ( system.getInfo("platformName") == "Android" ) then gameNetwork.show( "leaderboards" ) else gameNetwork.show( "leaderboards", { leaderboard = {timeScope="AllTime"} } ) end return true end end

Main.lua (the sign in process at the beggining of the game works)

gameNetwork = require( "gameNetwork" ) 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

Thank you in advance!

James x

Where do you call gameNetworkSetup()?

Sorry the following is also in the main.lua:
 

------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 print("set up network") end return true end Runtime:addEventListener( "system", systemEvents )

Thanks for your reply!

James

bump

I suggest putting in some print statements and see where you’re getting to and make sure you’re getting the values you expect.  Just to be sure you have the plugin code in your build.settings and you don’t have any errors there?  Are there any errors in your device’s console log?

Rob

No errors in the console log when using ADB logcat. The leaderboard showed up today when i reinstalled and clicked it. However it did not show up again despite the print into the console about the leaderboard opening. I need the leaderboard to give some sort of competitive edge. Is there nothing I can do?

Are you doing “adb logcat” or are you doing it with more options including “Corona” on the command line?

Rob

I use " adb logcat Corona** :v *:s**" and its just not displaying an error on clicking leaderboards. Is there anyway you can help?

This is my build.settings file:

-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = "landscapeRight", supported = { "landscapeRight", } }, android = { usesPermissions = { "com.android.vending.BILLING", }, googlePlayGamesAppId = "29844238489347" --long App ID number (use yours!) }, plugins = { ["CoronaProvider.analytics.flurry"] = { publisherId = "com.coronalabs", }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs" }, }, iphone = { plist = { UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend --[[-- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fbXXXXXXXXXXXXXX", -- example scheme for facebook "coronasdkapp", -- example second scheme } } } --]] } }, --[[-- Android permissions androidPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_WIFI\_STATE", "android.permission.READ\_PHONE\_STATE", "android.permission.ACCESS\_NETWORK\_STATE", },]]-- }

Okay just completely analysed logcat and it says “Warning, Game Network library not available on this platform”

Okay! Right I now have only one problem. I can connect to the leaderboards via mobile signal but I cannot connect via wifi. All files and settings are the same!

any Idea what the problem is?

bump!

Why are  your android permissions commented out?

Rob

They’re not are they? Can you just post the bit of code I need to change? and if i need to add any other permissions

-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = {     orientation = {         default = "landscapeRight",         supported = { "landscapeRight", }     },     android = {         usesPermissions =         {             "com.android.vending.BILLING",             "android.permission.INTERNET",             "android.permission.ACCESS\_NETWORK\_STATE",             "android.permission.WRITE\_EXTERNAL\_STORAGE",             "com.android.vending.CHECK\_LICENSE",         },         googlePlayGamesAppId = "29844238489347"  --long App ID number (use yours!)     },          plugins = {         ["CoronaProvider.analytics.flurry"] =         {             publisherId = "com.coronalabs",         },         ["plugin.google.play.services"] =         {             publisherId = "com.coronalabs"         },     },                iphone = {         plist = {             UIStatusBarHidden = false,             UIPrerenderedIcon = true, -- set to false for "shine" overlay         }     },     }

 

If you’ve not read this, it might help with understanding build.settings:

http://coronalabs.com/blog/2014/07/08/tutorial-understanding-build-settings/

Rob

Hey there nothing worked, I will just publish etc and see if it works. If not ill come back and sort it out. Thank you very much for all your replys"

Where do you call gameNetworkSetup()?

Sorry the following is also in the main.lua:
 

------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 print("set up network") end return true end Runtime:addEventListener( "system", systemEvents )

Thanks for your reply!

James

bump

I suggest putting in some print statements and see where you’re getting to and make sure you’re getting the values you expect.  Just to be sure you have the plugin code in your build.settings and you don’t have any errors there?  Are there any errors in your device’s console log?

Rob

No errors in the console log when using ADB logcat. The leaderboard showed up today when i reinstalled and clicked it. However it did not show up again despite the print into the console about the leaderboard opening. I need the leaderboard to give some sort of competitive edge. Is there nothing I can do?