Check internet by appformative

WeiyuWeiyu Posts: 201Member, PRO
edited July 2017 in Working with GS (Mac)

@Hopscotch Excuse me, I’m sorry to bother you.

I feel this discussion is so cool after I read this post.

So I tried to make it which check internet with appformative, and I have gotten this data in my table.

But I have no idea, how to used this data to check connect internet or not?
Could you teach me that? thank you.


  • johnnymagnejohnnymagne NorwayPosts: 112Member

    Just check the callback attribute; if it is set to 1 after you have run your Appformative code, then there is internet connection

  • WeiyuWeiyu Posts: 201Member, PRO
    edited July 2017

    @johnnymagne Thank you for answer.

    But I'm sorry about that, I'm still not clear :'(

    Could you check whether my behaviour is correct or not?

    Every 20 s

    Network Get Table From URL
    URL: game.get_servertime_URL .. game.AF_UserID
    Table: T_Analytics
    Callback Attribute: self.firstcontact

    Rule (not in timer)
    If "seld.firstcontact = 1"
    Touch pressed and do change scene to "A"

  • HopscotchHopscotch Posts: 2,769Member, PRO


    that will work, but your Timer should not be set to every 20s! That will drive the users data usage up and drain the battery. Checking once every few minutes is enough.

  • WeiyuWeiyu Posts: 201Member, PRO
    edited July 2017

    @Hopscotch I'm so glad you can answer my questions :D
    Thank you for answer.

    Then I have a little trouble, my callback attribute will loops repeated.(0→1, 1→0), when it every check. (This gif is 4 times speed)

    Does callback attribute can fixed?

    For example: If game connect to the internet, self.firstcontack will fixed value to 1 ,
    ( Unless the internet not connected, it can't changed the value to 0, when every check.)

  • HopscotchHopscotch Posts: 2,769Member, PRO


    GS sets the callback to 0 when the network call gets made.

    Ideally, have a separate attribute, e.g. isOnline. Then do the network call, and when the callback turns 1, set the isOnline attribute. If the callback does not turn 1 after a few seconds, assume they are not online and turn the isOnline attribute off.

  • WeiyuWeiyu Posts: 201Member, PRO

    This is a very helpful answer, thank you.
    I appreciate your help. :D

  • johnnymagnejohnnymagne NorwayPosts: 112Member

    Glad you solved it.!

Sign In or Register to comment.