I am writing a mobile app in Qt Creator and I want to enable and disable certain behaviors depending on whether the device is 1) disconnected 2) connected via cellular or 3) connected via wifi. I see AppFramework.network has several properties that seem to be in the ballpark. Specifically AppFramework.network.BearerWLAN looks like it might indicate the network is wifi and all the other Bearer~ properties (other than BearerEthernet) suggest cellular connections. Is this correct? If so, how do I leverage this property which is numeric to compare it to my boolean property that indicates if the user has chosen to only use wifi connections? It doesn't appear I can verify it like this:
if (AppFramework.network.isOnline && ( (wifiOnly.checked && AppFramework.network.BearerWLAN) || (wifiCell.checked) ))
wifiOnly.checked and wifiCell.checked are user-configured settings in the app for the permitted connectivity.
Thanks,
Ken
Solved! Go to Solution.
Hey Ken,
There isn't currently anything available through AppFramework, and Qt itself doesn't seem to have this either. We are looking into potential solutions for this in a future release.
-Luke
Hey Ken,
There isn't currently anything available through AppFramework, and Qt itself doesn't seem to have this either. We are looking into potential solutions for this in a future release.
-Luke
Hi Ken.
I played around with this as wanted to do the same thing, but came to similar place as you...
This seemed to be able to pick up whether the connection was Ethernet or not, but it didn't seem to be able to pick up wifi, 3G, etc.
console.log("AppFramework.network????", JSON.stringify( AppFramework.network.defaultConfiguration) )
AppFramework.network???? {"bearerType":1,"bearerTypeFamily":1,"bearerTypeName":"Ethernet","children":[],"identifier":"xxxxxxxxx","isRoamingAvailable":false,"isValid":true,"name":"Ethernet","purpose":0,"state":14,"type":0}
Sorry, not a particularly helpful comment but adds to the conversation and confirms as something that I think users will definitely look for in a future release.
-Paul