Wifi and mobile data status

is there a way to check the status of the device wifi and mobile data, whether they are on or off?

You could use Shortcuts and x-callback-url like this:

var url = new CallbackURL('shortcuts://run-shortcut')
url.addParameter('name', 'Get WiFi Status')
var response = await url.open()
wifiIsConnected = response.result != undefined

This is running a shortcut named “Get WiFi Status” and saving the response in a variable.

This is the Shortcut I used:


translation: get name of network from wifi > end shortcut with network name

The response will look something like this:

{
  "result": "[network name]"
}

And if no network is connected exactly like this:

{
  "result": undefined
}

I have not found a way to do this for mobile data.