Block reference / Device Management
Check network
Check whether the phone reaches the internet, and read the public IP sites see it at.
Only in
WarpX Phone
Check network asks from the phone itself whether it can reach the internet, and through which address. Because the check runs on the phone, it goes through the phone's proxy when it has one, so the IP is the one every app and site sees. Use it after Phone identity or Toggle service to make sure the phone is online on the right address before an app is opened.
Settings
- Fail when the phone is offline
Fails the block when nothing answered, so On error in the block's settings can stop the run or take another path. Off, an offline phone only writes
false.ExampleChecked- Save whether it is online (true / false) to a variable
Writes
trueorfalseinto a workflow variable, for a Conditions block to branch on.ExampleUnchecked- Variable namewhen Save whether it is online (true / false) to a variable is on
The unlabelled box under the checkbox: the variable that receives
trueorfalse.Exampleonline- Save the public IP to a variable
The name of a variable to receive the public IP, such as
203.0.113.45. Empty, the IP is not saved. When no address came back, the variable is set to empty text.ExamplepublicIp- Delay (ms)
A wait after the block finishes, before the next one starts. One number such as
1000, or a range such as1000,3000for a random wait in that range on each run.Example0
Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.
What it hands on
Hands on true or false as {{prevBlockData}}, and writes the two variables when they are named. With Fail when the phone is offline on, an offline phone fails the block with The phone does not reach the internet.
Example: Check that a phone is online on its proxy's address before opening an app
- Start
- Phone identity
- Check network
- Start app
- Pick the phone in the toolbar's phone menu.
- Add a Phone identity block that puts the phone on its proxy.
- Add a Check network block. Tick Fail when the phone is offline and set Save the public IP to a variable to
publicIp. - Add a Start app block for the app the run is for.
- Click Run and open Logs:
publicIpholds the proxy's address, not the phone's own.
Good to know
- Three checks run on the phone: a ping to
8.8.8.8, a ping togoogle.com, and a request toapi.ipify.orgover HTTP for the IP. The phone counts as online when any of them answers, since some networks drop pings. The whole check takes up to about 15 seconds. - The IP comes from a plain HTTP request on port 80. A network or proxy that blocks it leaves the IP empty while the phone may still be online.
See also
- Phone identity — Put the phone on a proxy, and set its location, time zone and language, all at once.
- Toggle service — Switch Wi-Fi, mobile data, Bluetooth, airplane mode or location on or off.
- Get device property — Read one fact about the phone, such as its model, Android version, battery level or IP.
- Conditions — Send the run down one of several paths, depending on values, page elements or code.