Anthony wrote:
The issue is that if there is no internet connection, initCallback() is not called at all. So the user will press the game center icon and get nothing. What is needed is a callback to indicate that login failed.
Newb here, you’re mileage may vary.
I’ve got my own GC issues, but my work around for this one is to check for network availability and if there is no network, when the GC button is tapped, fire off an alert that tells the user “Game Center not available, no internet connection”.
I like your suggestion, this may help though.
Here’s what I use and it should give you a jump start, it works for me anyways.
-- function to listen for system events
local function onSystemEvent( event )
if event.type == "applicationStart" then
print("ApplicationStart from onSystemEvent has been called")
NetworkAvailable = false
loggedIntoGC = false
if network.canDetectNetworkStatusChanges then
network.setStatusListener( "www.google.com", myNetworkReachabilityListener )
print("network.setStatusListener has been called aimed at Google")
else
network.setStatusListener( "www.google.com", nil )
native.showAlert( "No Internet Connection!", "User is not logged into Game Center", { "OK" } )
print("network reachability not supported on this platform")
NetworkAvailable = false
loggedIntoGC = false
end
elseif event.type == "applicationSuspend" then
--DeviceSuspend = true
NetworkAvailable = false
loggedIntoGC = false
print("deviceSuspendMonitor() is called/ DeviceSuspend = true")
elseif event.type == "applicationResume" then
NetworkAvailable = false
loggedIntoGC = false
if network.canDetectNetworkStatusChanges then
network.setStatusListener( "www.google.com", myNetworkReachabilityListener )
print("network.setStatusListener has been called aimed at Google")
else
network.setStatusListener( "www.google.com", nil )
native.showAlert( "No Internet Connection!", "User is not logged into Game Center", { "OK" } )
print("network reachability not supported on this platform")
NetworkAvailable = false
loggedIntoGC = false
end
end
return true
else return
end
Runtime:addEventListener( "system", onSystemEvent )
Hope this helps.
Nail [import]uid: 106779 topic_id: 31738 reply_id: 126764[/import]