Unsolved Can't initiate network connection in Android extra example
-
Hi,
My Qt creator is 4.3.1 based on Qt 5.9, there is an example which interests me, named notification under Qt5.9.1\Examples\Qt-5.9.1\androidextras.
I tried to add some code in NotificationClient.java, as:
protected static void myconnect(final String svrAddr, final int port) { final SocketAddress serverAddress = new InetSocketAddress(svrAddr, port); try { // Connect to the server. DatagramChannel tunnel = DatagramChannel.open(); tunnel.connect(serverAddress); }catch (IOException e) { System.err.println(e.toString()); } }
And Then in
public static void notify(String s)
{
....
myconnect("10.10.10.1", 80);
...
}Of course in the AndroidManifest.xml I added the INTERNET permission and proper "import java.nio.channels.DatagramChannel;" in java file.
It compiles successfully, and I installed the apk in my Android phone, by clicking on the icon, the tcpdump in the server side doesn't receive any packet from the phone.Should I say Qt can't do the connection in Android extra mode?
Thanks