Mobile data? Android offline issues.

Posted by RiverIsRising
My game works perfectly on Android for posting new scores and showing the in-game leaderboard when connected to wifi. However, I noticed if am on 3G or 4G mobile data instead, it doesn't work. Is there a way to connect to the server using mobile data too? Second, if you are offline, I'd still like to play my game regardless (as it's single player) and merely bypass the leaderboard functions temporarily, but how do I go about this? I've tried using the gm code "if os_is_network_connected()" to check the network before running any game server scripts (works on my pc) but android considers 'mobile data' as a network too and therefore breaks through this and shows fatal errors. Do you have a solution for this? Thank you!

Replies (3)

Last message on 23 Dec 2015

Size43 (Administrator) on 22 Dec 2015, 15:12:36
You can check whether you are connected to the server using gms_info_isconnected().

I'm not too sure how the permissions on android work, but is there maybe a separate permission for mobile data that needs to be enabled? My best guess if that's not the case would be that your mobile provider is blocking connections to some ports, which I unfortunately can't do anything about.
RiverIsRising (Topicstarter) on 23 Dec 2015, 02:54:40
Can't believe it was that simple, "gms_info_isconnected" seemed to do the trick!

I have all permissions enabled (except for bluetooth) and in-app purchases with google play and colony ads work fine with mobile data so I don't think it's the permissions. But surprisingly leaderboards just started showing with mobile data, the only change I made was the code above, so I guess it's good. Appreciate the help!
Size43 (Administrator) on 23 Dec 2015, 11:20:26
No problem, I'm glad it's all working now :)