How to check the device is connected to the internet or not?

Question as titled.
And by the way, does the ChartBoost non-video ads have any limitations? For example can't use too often?

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    There is no way in Gamesalad to check if the device is connected to the internet.

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited January 2016

    @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.

  • BigDaveBigDave Member Posts: 2,239
    edited January 2016

    @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

  • ArmellineArmelline Member, PRO Posts: 5,420

    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.

  • BigDaveBigDave Member Posts: 2,239

    @Armelline
    oh true forgot about that

  • OrvilFoxOrvilFox Member Posts: 67

    @Hopscotch said:
    @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.

    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.

  • OrvilFoxOrvilFox Member Posts: 67

    @BigDave said:
    @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

    Thank you! And thank you @Armelline .
    I'll try it out later on.

  • BigDaveBigDave Member Posts: 2,239

    @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)

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @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.

  • zellhuangzellhuang Member, PRO Posts: 79

    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 :)

  • dlaimdlaim Member Posts: 110

    The simplest solution is what @Armelline saied:
    Use iAP request. It just works fine for me.

Sign In or Register to comment.