November 4th 2014, Android Internet Connection Status
← October 31th 2014 Evaluation of libexiv2 | ● | November 5th 2014 Android Extras →
Checking the internet connection type on Android is important to minimize traffic if the connection is slow or expensive. With Qt 5.3 this was not 100% possible, since the generic bearer plugin of this release reported a WLAN connection as “Ethernet” and a mobile connection as “Unknown”. With Qt 5.4 the generic bearer plugin has been replaced with a android-specific one, which solves the issues.
So with Qt 5.4 we create an instance of a QNetWorkConfigurationManager like so
And ask the manager which connections are discovered to be available for internet access:
for (auto i=netlist.begin(); i!=netlist.end(); i++)
switch (i->bearerType())
{
case QNetworkConfiguration::BearerEthernet:
case QNetworkConfiguration::BearerWLAN:
qDebug() << "fast connection discovered";
break;
default:
qDebug() << "slow connection discovered";
break;
}
← October 31th 2014 Evaluation of libexiv2 | ● | November 5th 2014 Android Extras →