MarekFric
9 years agoOccasional Contributor
Get Internet connection state
Hi all, Is it possible to get Internet connection state ? I would like to find out if my connected device has Internet connection or not. Googling I found only approach for programmers - http://s...
- 9 years ago
Hi Marek,
Your device appears to have a version of ping that can only run as a standard user. However, adb shell and TestComplete's ShellExecute run commands as root by default, hence the error. This link suggests changing file permissions for ping to make it compatible with adb shell -- if that's OK in your case. I couldn't find a general way to run adb shell commands as a standard/non-root user though.
Other possible solutions would be to use external apps. For example:
- Write a helper Android app (or find an existing one) that would check Internet connectivity. See these links for code examples.
- If you have an instrumented application with a WebView, you can try navigating the WebView to some site, and check if the page loads successfully.
Hope this helps.