I have no idea if the code below can be any use for iOS. It was posted by Phil Davis a few months back and I use it in my desktop apps. Obviously the switch commands for the desktop platforms are not relevant but perhaps the methodology could still work.
*function* appIsConnected purl *local* tShellOutput,tResult *switch* (the platform) *case* "MacOS" *put* shell("ping -c 1 -t 5" && purl) into tShellOutput *put* the result into tResult *break* *case* "Win32" *-- PD 20100411* *set* the hideConsoleWindows to true *put* shell("ping -n 1 -w 5000" && purl) into tShellOutput *put* the result into tResult *break* *case* "Linux" *put* shell("ping -c 1 -w 5") && purl into tShellOutput *put* the result into tResult *break* *default* *-- all other OSes* *put* param(0) & colon && the platform && "platform not supported" into tResult *break* *end* *switch* *-- check for connection failure* *if* tResult <> empty *then* *return* false *-- failed* *else* *-- connected, but how well?* *set* the itemDel to comma *switch* the platform *case* "Win32" *get* tShellOutput *filter* it with "*(0% loss)*" *break* *case* "MacOS" *repeat* for each item tFilter in "* 0% packet loss*,* 0.0% packet loss*" *-- for different OS versons* *get* tShellOutput *filter* it with tFilter *if* it <> empty *then* *exit* *repeat* *end* *repeat* *break* *end* *switch* *return* (it <> empty) *end* *if* *end* appIsConnected Pete lcSQL Software <http://www.lcsql.com> On Wed, Oct 10, 2012 at 2:39 PM, Chris Sheffield <cmsheffi...@me.com> wrote: > Does anyone have a good way in an iOS app to determine if an Internet > connection is available? I'm not finding anything very useful in the LC > Dictionary. Bonus points if there's also a way to determine the type of > connection available (WiFi vs. cell service (3G/4G)). > > Thanks, > Chris > > > -- > Chris Sheffield > Read Naturally, Inc. > www.readnaturally.com > > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode