No, there is not a Corona SDK bug. There is something wrong in your code. Since I can’t see your complete project, I’m going to post a simple project below for you to try out:
build.settings
settings = { orientation = { default = "portrait", supported = { "portrait", "portraitUpsideDown" } }, android = { usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.WRITE\_EXTERNAL\_STORAGE", "com.android.vending.BILLING", "com.android.vending.CHECK\_LICENSE", }, googlePlayGamesAppId = "xxxxxxxxxxxxxxxx", }, plugins = { ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["CoronaProvider.gameNetwork.google"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true }, }, ["CoronaProvider.gameNetwork.apple"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, ["iphone-sim"]=true }, }, }, iphone = { plist = { CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon@3x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-40@3x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, UIApplicationExitsOnSuspend = false, -- must be false for single sign-on to work } }, excludeFiles = { iphone = { 'Icon-\*dpi.png', 'Icon-ouya.png', 'audio/\*.oog' }, android = { 'Icon.png', 'Icon-6\*.png', 'Icon-7\*.png', 'Icon-Small\*.png', 'Icon@2x.png', 'Default-568h@2x.png', 'audio/\*.m4a' } }, }
main.lua
local composer = require( "composer" ) local widget = require( "widget" ) local gameNetwork = require("gameNetwork") math.randomseed( os.time() ) local function loadLocalPlayerCallback( event ) print("You are ", event.data.alias) 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 authorize() print("In autuhorize") if ( system.getInfo("platformName") == "Android" ) then print("logging into GPGS") gameNetwork.init( "google", gpgsInitCallback ) else print("logging in to GameCenter") gameNetwork.init( "gamecenter", gameNetworkLoginCallback ) end end authorize() composer.gotoScene( "menu" )
menu.lua
local composer = require( "composer" ) local scene = composer.newScene() local gameNetwork = require("gameNetwork") local widget = require( "widget" ) local function handlePlayButtonEvent( event ) if ( "ended" == event.phase ) then gameNetwork.show( "leaderboards", { leaderboard={ timeScope="Week" }, listener=showLeaders } ) end end -- -- Start the composer event handlers -- function scene:create( event ) local sceneGroup = self.view -- -- setup a page background, really not that important though composer -- crashes out if there isn't a display object in the view. -- local background = display.newRect(0, 0, display.contentWidth, display.contentHeight) background.x = display.contentCenterX background.y = display.contentCenterY sceneGroup:insert(background) -- Create the widget local playButton = widget.newButton({ label = "Show Leaderboard", onEvent = handlePlayButtonEvent }) playButton.x = display.contentCenterX playButton.y = display.contentCenterY sceneGroup:insert( playButton ) end function scene:show( event ) local sceneGroup = self.view if event.phase == "did" then end end function scene:hide( event ) local sceneGroup = self.view if event.phase == "will" then end end function scene:destroy( event ) local sceneGroup = self.view end --------------------------------------------------------------------------------- -- END OF YOUR IMPLEMENTATION --------------------------------------------------------------------------------- scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) return scene
This code will successfully login to GameCenter and allow you to show leaderboards. Compare your code to this code and see where you are different.
Rob