How to check the device is connected to the internet or not?
OrvilFox
Member Posts: 67
Question as titled.
And by the way, does the ChartBoost non-video ads have any limitations? For example can't use too often?
Comments
There is no way in Gamesalad to check if the device is connected to the internet.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
@neo1998x you would have to use some back-end server, send a request and see if it gives a response.
You can use a service like ours (signature below) or set up your own.
Regarding the ads, using too many too often will make your users unhappy before Chartboost gets unhappy. The frequency should not be too high.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@neo1998x
yes use appformative for that.
They also have an easy tutorial
http://www.appformative.com/implementation_gamesalad_thebasics.mox
The attribute Callback/firstcontact that you get by contacting the server is initialized to 0. If the command succeeds, it will be set to 1, and if it fails, it will be set to -1.
You could have a boolean in your project like
Internet active = false
if self.firstcontact is 1
->change boolean to true
if self.firstcontact -1
->change boolean to false
and make them able to continue playing based on that boolean
My Apps
https://itunes.apple.com/de/artist/david-zobrist/id733552276
https://play.google.com/store/apps/developer?id=David+Zobrist&hl=de
Use the In App Purchase - Request Purchase Data behaviour. It won't be a guaranteed check, as Apple's servers could be down or not responding, but it's probably the simplest way.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Armelline
oh true forgot about that
My Apps
https://itunes.apple.com/de/artist/david-zobrist/id733552276
https://play.google.com/store/apps/developer?id=David+Zobrist&hl=de
Well, it's not about happy or unhappy.
I'm about to use it for reward, like 1 extra view of ad you got 5 gems.
But I'm not sure on the ChartBoost side they allow to do it.
Players will be certainly happy.
Thank you! And thank you @Armelline .
I'll try it out later on.
@neo1998x
i am not sure if it actually works, atleast with the external server(app formative)
It works in the simulator on the mac by turning off my internet it switches to "no internet connection" scene
by turning it back on it switches back to main screen
but on the mobile version it remains in the no internet connection even if there is internet. (wlan)
My Apps
https://itunes.apple.com/de/artist/david-zobrist/id733552276
https://play.google.com/store/apps/developer?id=David+Zobrist&hl=de
@BigDave your example is fine, but using a change scene in this case will not work.
The networking behavior set the call back attribute to 1 only after it completed its operation successfully. In a mobile environment this can take a few milliseconds, long enough for the rule first to trigger the -1 state, thus changing scene and no longer registering the success state of 1.
It is better to call the networking behavior, then only test for a positive response (1) after a delay of about 0.5 seconds to accommodate for slow mobile traffic.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
hi dude, i'm glad to tell you i have a solution and it works because i've already tried on my project.
Just use Networking behavior send a table to your server. follow this tutorial http://help.gamesalad.com/gamesalad-cookbook/7-using-pro-features/7-05-networking-behaviors-2/
it's quit simple. Only thing you need is a server
The simplest solution is what @Armelline saied:
Use iAP request. It just works fine for me.