Mobile Check Bandwidth Function

Sannyasin Brahmanathaswami brahma at hindu.org
Mon Jul 3 00:16:47 EDT 2017


Good thoughts,

Spotify actually will inform you that you don't have a connection even if you have 3G up..  

I would like to know how they do that.. because my app *can* ping our server over 3G… but Spotify deems the connection  insufficient to stream music and displays the "disconnected" icon.  So this goes to the speed testing you are looking for..

 I suspect another issue. I won't know for sure until I test tomorrow. But the mere act of "fishing on the internet" may hang the OS on mobile.

ergo.. on desktop this works

function pingServer
   # call from any where to inform user and disable activities
   # that require internet access to our server or any the external service
   put url "https://www.himalayanacademy.com/ping.txt" into sOnlineStatus 
   return sOnlineStatus
end pingServer

and if I unplug ethernet and turn off wifi  I can run from the msg box "put pingServer()" and not happens.. just returns empty

but my current behavior (still to be sorted) indicates that just try to fetch a URL, without a connection causes my app to hang.

I only discovered this serendipitously when the local router in our neighborhood suddenly started having trouble. We thought it was local to our LAN-place but the ISP in town said "People all over that area are complaining, their internet dropping on and off." of course has to happen on 4th July weekend (hehe)

My phone was connected to the local wifi→ to our modem → out the door down the street the "regional" router.  I was trying to show off my app and it would just hang on modules that expecting connectivity. but I *did* have my ping test functional. 

I have similar/parallel issues with in house apps that test to see if the LAN network is up or not. You can do peculiar things that cause Apple's network API to stop and think for 2 minutes!

Leads to 2 further questions

1) is there a low level check on iOS/Android for connectivity that we can use vs calling out to our server? Some people use Google DNS servers for this test, but it would be *any* http request.
  -- I looked  through all dictionary entries for "mobile*" and found nothing relevant, though possibly there is some sensor we can query?
2) anyone know how to turn off connectivity, on your phone, even if you have your sim card in? I'm not finding a way to actually turn off LTE or 3G access.
  -- I missing something simple there… on my Nexus 5  I don't have a SIM card (used only for testing, no cellular or data plan) but I can do everything if I am in proximity of our wifi, so for android I can just turn off wifi and the phone is "off line" for sure, but iOS?


BR


 

On 7/2/17, 4:44 PM, "use-livecode on behalf of Peter Bogdanoff via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:

    I’m also very interested in this.
    
    I’m thinking that it might be possible to use a LC-only method:
    1. A player control starts downloading a known-size media file.
    
    2. The player reports when its <status> is no longer “loading,” then you calculate the data rate based on the elapsed time.
    (In LC for Windows only, the player has a loadedTime property with which one could presumably calculate data rate.)
    
    3. Possibly another method would be to set the callbacks of the player, such as one callback every 500 milliseconds. You would use a timer to figure how long it takes to receive each callback. If they are arriving every half second for a large file, then the speed needle would move the “Good” range. If the download is slow, the callbacks would be late, and the needle would move to the “you must be a rural Internet customer” area.
    
    This kind of thing would require a “speed test” event before the results could be reported to the user.
    
    Creating/testing this might be a challenge if you happen to have a good connection. You would have to somehow slow down your speed, or have someone else test it who does have a slow connection. Also, after loading a file, LC keeps it in a cache unless you dump it.
    
    Peter Bogdanoff
    
    



More information about the use-livecode mailing list