[Android-development] connect to wifi via Qt

Katerina Karagiannaki kat.karayan at gmail.com
Thu Sep 4 16:04:28 CEST 2014


Hello everyone,

I am developing an application on Qt for Android. The application serves 
the role of aTCPclient that connects to a server written in C++ and 
retrieves data from it. I also have deployed it on my Android phone.

I am also trying to connect to a wifi network programmatically via Qt. I 
have read the documentation of Bearer Management and 
QNetworkConfiguration and I am able to find all the available 
configurations in the wlan0 interface. I am also able to start a new 
session for a configuration and see all available interfaces etc.
Therefore I think I have understood how the documentation works, but I 
am not able to connect to a wifi.
I have read in the Qt forums that there is no built-in way in Qt to do 
that, and that I need to use some native api.

Another thing that i’ve tried is to execute a QProcess with Linux system 
calls, such as ifconfig and iwconfig to connect to the wifi in the same 
way as in Linux terminal (Qt desktop version) but I haven’t seen any 
results and if I see any, I don’t know if that will work in Android.

Is there a way to connect to wifi via Qt? Is there anything in the 
documentation that i have not seen or understood yet? If not, is it 
possible to do it in C++ with someAPIfor Linux? (I have found out that 
there areAPIs on Windows that do this but my server needs to be running 
on a Linux device).

Finally, I am also thinking if it is possible to establish a wifi 
connection in Java. I googled and found code snippets in Android Java 
that make that connection possible. Is there a way to do that in Qt - 
run Java code with android packages (from Android SDK) somehow? I found 
this link -> 
http://developer.android.com/training/articles/perf-jni.html , should I 
continue towards that direction or better find something else?

Sorry for the burst of questions, but I've been facing that problem for 
quite a while.
Any help would be great!

Thanks in advance,
Katerina

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20140904/1407f427/attachment.html>


More information about the Android-development mailing list