detect internet connection

anyone have a way of detecting if the phone has signal or not before firing a makewebrequest?  i'm checking for bluetooth via System.getDeviceSettings().phoneConnected, but  if thats good, i blindly fire makewebrequest and if there's no phone signal, i have to just wait 5 minutes before attempting again.  would love a way of knowing ahead of time, that way i can monitor the signal and only fire when i know i'll get a response, or at least have a better chance of getting a response anyhow if it's a weak signal.

  • Unfortunately there is no better way.

    phoneConnected is your best bet at the moment.

  • One thing to understand is that phoneConnected isn't the only way there's an internet connection.  One is possible with both WiFi and LTE.

    You can see if is one is available with Sys.getDeviceSettings().connectionAvailable and look at what's available with connectionInfo,  

    checking phoneConnected should work if you're only concerned about BT, and if that's showing the phone is connected and it's not, what device are you using because it should, unless there's a small timing window where the connection just dropped yet the watch still thinks there is one..

  • i didn't think there was, but just wanted to check.  seems like a good feature request to provide a way to report how much signal the connected phone has.  i live along the front range in colorado, so between the dirt farm roads and mountain climbs, i'm often out of cell signal range (tough riding conditions i know :) ).  i've also got a use case of first responders that are often out of signal range.  i'd love to be able to detect when i'm in signal range and make the connection immediately, instead of getting into a 5 minute check and repeat cycle.  

    i also saw a request to remove or shorten the 5 minute period, so that would probably help as well.  i've never had any complaints from any of my api-centric apps about decreased battery performance, so i'm all for that.

    yep, jim, i know about wifi and lte connections (saw your great post about detecting lte), but the lte seems to just detect the capability of the device and not whether there is actually signal.  same with wifi.  a potential hasSignal feature would ideally look across all 3 of those and tell you if a makeWebRequest has a chance of actually getting sent, as it's my understanding the firmware decides how to actually send that under the covers based on available connections.

  • That’s how I understood your requirements, hence I didn’t mention the wifi and lte stuff.