Solved Problem in Qt + Android + Wifi
-
I am using Qt 5.7 with Android. I want to list the available wifi networks on a mobile and connect to one of them.
However, this does not work. I am seeing just "Wifi" as the item in the list and not the list of networks available.
I refer to the post on the forum where SGaist has mentioned about the problem and asked Qojote to try it with 5.6.
Does anyone know the solution to this problem?
My slot for searching for networks is as given here.void Connect_port::Search_WIFI_NW() { QIcon icon(":/Images/wifi_icon.png"); QNetworkConfigurationManager NCM; ui->lst_available_NW->clear(); NCM.allConfigurations().clear(); NCM.updateConfigurations(); for(int i=0 ; i < NCM.allConfigurations().count() ; i++) { qDebug()<<"NCM Count "<<NCM.allConfigurations().count()<< "Bearer = "<<NCM.allConfigurations().at(i).bearerType(); if(NCM.allConfigurations().at(i).bearerType() == QNetworkConfiguration::BearerWLAN) { if(!NCM.allConfigurations().at(i).name().isEmpty()) { if(NCM.allConfigurations().at(i).state() == QNetworkConfiguration::Active) { QString star="*** "; QListWidgetItem *item = new QListWidgetItem(icon,NCM.allConfigurations().at(i).name().insert(0,star), ui->lst_available_NW); ui->lst_available_NW->addItem(item); } else { QListWidgetItem *item = new QListWidgetItem(icon, NCM.allConfigurations().at(i).name(), ui->lst_available_NW); ui->lst_available_NW->addItem(item); } } } } }
-
Hi,
IMHO it is not possible to use the Bearer Management for your task. You will have to use native Java code to find WLANs and connect to them.