Ask / Submit
3

How to find out if phone is connected to wlan or cellular network

asked 2014-01-13 18:24:53 +0200

juke gravatar image

updated 2014-01-14 09:45:52 +0200

eric gravatar image

The only online documentation for QT SystemInfo has a method for querying the current network mode

QNetworkInfo::currentNetworkMode()

which according to documentation should be able to return NetworkInfo.WlanMode.

When my phone is without SIM card the method above returns NetworkInfo.UnknownMode even if the phone is connected to a WLAN. With SIM card the method returns NetworkInfo.LteMode regardless of whether WLAN is used or not.

With QT Mobility I used the signalStrenght method for figuring which network is used, but that always returns -1 for WLANs in QT SystemInfo.

So is there another API for getting this information?

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
2

answered 2014-01-13 19:23:08 +0200

pycage gravatar image

updated 2014-01-13 19:23:28 +0200

Look at QNetworkConfigurationManager:

QNetworkConfigurationManager ncm;
QNetworkConfiguration::BearerType bearer = ncm.defaultConfiguration().bearerType();

switch (bearer)
{
case ...
.
.
.
}
edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2014-01-13 18:24:53 +0200

Seen: 464 times

Last updated: Jan 13 '14