By means of this extension we can check if the internet data comes to us through WiFi or through the data network (Mobile data. Cellular). We can also get if "Mobile data" is enabled.
- It works with API >= 21
- Tested on Android 9.
com.KIO4_TransportNet.aix (11.5 KB)
Check if Cellular (Mobile data) is enabled. Return a boolean.
Check if Cellular (Mobile data) is actual transport of data. Return a boolean.
Check if WiFi is actual transport of data. Return a boolean.
Start Event CheckTransport. Return boolean true. There should not be more than one register at a time. Look at the example.
Stop Event CheckTransport. Return boolean false.
If transport is WiFi, gets this String: WiFi,SignalStrength,"SSID"
If transport is Cellular, gets this String: Cellular,0,NameOperator
If it does not transport by WiFi or Cellular, gets this String: -,0,-
Gets API of device.
p232_extension_ConsultaRed.aia (12.3 KB)
- Other information.
On this website in Spanish you can find more information and updates:
This extension uses:
https://developer.android.com/reference/android/net/NetworkCapabilities API >= 21
The extension code is based on this guide:
I have use the nomenclature "Transport" and "Cellular" because it is the one that uses this class (TRANSPORT_CELLULAR).
There are other similar extensions but they don't work with API 29 as they seem to use https://developer.android.com/reference/android/net/NetworkInfo it was deprecated in API level 29.
Could someone try this extension on Android 10, Android 11, ...