I am trying to receive data in an Android app from TCP server on an IoT device. I have searched on the internet. But I found information about transferring files between two android devices using WiFiP2PManager, WiFi Direct etc.
Problem:
Note:
App and device are not connected to a common network.
Steps:
- App gets connected to device using BLE
- App sends a command to device to make it ready for hotspot pairing
- App tries to connect hotspot created by the device
- App gets data using: http://ip-address/data e.g. http://192.168.123.132/data
I'm not able to figure out how to solve the third and fourth step. I'm able to connect the device using WifiManager. But it gets disconnected and android switch back to the strong network available. How to stay connected to a particular network even though it doesn't have internet? I need to do this programmatically.
Thank you