I am working on a app that connects to another device via WiFi. I then use HttpUrlConnection to send request for JSON result.
As this WiFi connection does not have internet access, the http request is often sent via the mobile network and thus timeout. If i disable my mobile network, it changes my WiFi to another one that has internet access.
So I would like to find out if i can achieve the followings:-
1) Restrict my app to go through the WiFi network instead of the mobile network even though it has no internet access
2) Can i prevent the WiFi change
Scenario:
1) My app is on Device A (has internet), it then connects to Device B (no internet) via WiFi.
2) When I send the http request from A to B, it went to the mobile network instead to Device B.
3) If i disable mobile data on Device A, it auto change the WiFi to another network with internet, thus disconnect from B.
4) My question is how to send request ONLY to B.
Thanks.