How can I be connected with both data and wifi network at the same time in android

1.1k views Asked by At

I have looked all the similar question related to this in SO . But couldn't find a solution and in most of the case the conclusion is "not possible" . But I have found an app named speedify , by using that app I am able to be connected with both wifi and data network at the same time .

Why do I need this ?

In my app, I am connected with a camera via wifi, I am fetching data from that camera and I need to send those data to server . While I am connected to that camera , I can't connect to any other network (WIFI or data connection) but by using the mentioned app, I can connect to both WIFI(which is used to connect with camera) and data network at the same time and I can fetch data from camera and send it to server.

I don't want any dependency in my app . How can I overcome this issue ?

Any help will be highly appreciated .

1

There are 1 answers

3
neuhaus On

Find all IP addresses of your phone. See How to get IP address of the device from code?

Use the wifi IP address to communicate with the camera. Use the other IP address to communicate with the internet via GSM.

To specify the local address use Socket() with the extra arguments:

Socket(String host, int port, InetAddress localAddr, int localPort) 

or

Socket(InetAddress address, int port, InetAddress localAddr, int localPort)