Select to view content in your preferred language

How can I know if connection is wifi or cellular

1877
2
Jump to solution
03-18-2016 12:38 PM
KenGorton
Esri Contributor

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

0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

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

View solution in original post

0 Kudos
2 Replies
LucasDanzinger
Esri Frequent Contributor

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

0 Kudos
by Anonymous User
Not applicable

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

0 Kudos