Qt + Android and WiFi
-
Hi and welcome to devnet,
I haven't tested that with Android but the Bearer Manager might be what your are looking for.
Hope it helps
-
Hi,
Yes, i read the article. When i run
QNetworkConfigurationManager manager; const bool canStartIAP = (manager.capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces);
canStartIAP is false. My app has all permissions to edit the wifi state.
Furthermore, wheni try the following code:QNetworkConfigurationManager ncm; QList<QNetworkConfiguration> nc = ncm.allConfigurations(); foreach( QNetworkConfiguration item, nc ) { if (item.bearerType() == QNetworkConfiguration::BearerWLAN) { qDebug() << "Wifi" << item.name(); qDebug() << "state" << item.state(); } }
then i see that my app knows that there exist a mobile and wifi network but the state is alway 0x2.
I am also able to use androidextras to run java code and use the wifimanager to switch on wifi (which works), but it would be nicer to use Qt-Code only...Best regards
-
From a quick look at the code, it seams that changing the connection state is currently not supported so you are on the correct track using the QtAndroidExtras module
-
Did you call QNetworkConfigurationManager::updateConfigurations ?
-
Which version of Android ?
-
Since Qt 5.6.0 is out, can you check again with it ?