I'm trying to use HTTP Request to control an IOT device when in the car. The IOT device has no internet connection so mobile data is active. Using HTTP Request chooses the mobile data interface, not the WiFi one, and there seems no way to force it to use the WiFi interface whilst mobile data is active.
My phone (Pixel 2/Oreo 8.1) isn't rooted. Set Mobile Datanetwork State doesn't work on this phone unrooted. My work-around is to temporarily disable mobile data using Control UI, issue the HTTP Request (which then goes to the WiFi interface), and re-enable mobile data after using Control UI. This is clunky and not always reliable as you might expect.
Anyone able to suggest anything better?
HTTP Request over WiFi
Moderator: Martin
Re: HTTP Request over WiFi
You mean when your Pixel 2 wifi is on, mobile data is on. Then you issue HTTP request, the phone will use data interface instead of wifi interface. So if your wifi is on 192.168.1.x, then you phone will try to find this via the mobile data interface, which of course will fail.
If it is so, it seems you phone prioritize mobile data over wifi. Or maybe your wifi doesn't have internet connection. Try to switch off keep mobile data on when wifi is poor (or maybe some different wording that stated switch to mobile data when wifi is not good). I try mine, when wifi and mobile data is on, wifi will be prioritized. I can still send clipboard to my PC via local network, not via the mobile data interface.
If it is so, it seems you phone prioritize mobile data over wifi. Or maybe your wifi doesn't have internet connection. Try to switch off keep mobile data on when wifi is poor (or maybe some different wording that stated switch to mobile data when wifi is not good). I try mine, when wifi and mobile data is on, wifi will be prioritized. I can still send clipboard to my PC via local network, not via the mobile data interface.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: HTTP Request over WiFi
> You mean when your Pixel 2 wifi is on, mobile data is on. Then you issue HTTP request, the phone will use data interface instead of wifi interface.
Yes
> it seems you phone prioritize mobile data over wifi.
Exactly
> I try mine, when wifi and mobile data is on, wifi will be prioritized.
Mine is the same only if the internet is available on WiFi. When WiFi is active and connected to the Internet mobile data gets switched off automatically by Android anyway. But in my scenario, the only WiFi device connected is the IOT device which is not connected to the Internet, so Android keeps mobile data on and sends the HTTP Request to the mobile interface. So in the status bar I see 4G active on mobile data and I'm connected with WiFi to my IOT device (which is a WiFi access point) and there is a x in the WiFi symbol because the IOT device does not offer internet connectivity. If I disable mobile data via Control UI the HTTP Request is sent via WiFi anyway - maybe Android works out there's nowhere else to route it!?
So the question is how to force the HTTP Request to the Wifi interface?
Yes
> it seems you phone prioritize mobile data over wifi.
Exactly
> I try mine, when wifi and mobile data is on, wifi will be prioritized.
Mine is the same only if the internet is available on WiFi. When WiFi is active and connected to the Internet mobile data gets switched off automatically by Android anyway. But in my scenario, the only WiFi device connected is the IOT device which is not connected to the Internet, so Android keeps mobile data on and sends the HTTP Request to the mobile interface. So in the status bar I see 4G active on mobile data and I'm connected with WiFi to my IOT device (which is a WiFi access point) and there is a x in the WiFi symbol because the IOT device does not offer internet connectivity. If I disable mobile data via Control UI the HTTP Request is sent via WiFi anyway - maybe Android works out there's nowhere else to route it!?
So the question is how to force the HTTP Request to the Wifi interface?
Re: HTTP Request over WiFi
Yes, it is a problem with IoT device with AP access (usually IP camera or its kind).
So your phone handle the cellular handover too aggressive. Try to find the setting which switch this. I don't own Pixel 2, can't check. But you can try to see at developer options to see if there is any switch you can pull to force the wifi to stay, even though no internet connection. It can be named as "avoice poor wifi connection", "mobile data always on", "Aggressive wifi to data handover" or similar thing.
And yes, this should be in the request section (as you've posted), so we can force HTTP over the wifi connection. Similar to my Trigger HTTP request, which force the server to listen only at wifi interface (has been implemented in EAP 1.36.0).
So your phone handle the cellular handover too aggressive. Try to find the setting which switch this. I don't own Pixel 2, can't check. But you can try to see at developer options to see if there is any switch you can pull to force the wifi to stay, even though no internet connection. It can be named as "avoice poor wifi connection", "mobile data always on", "Aggressive wifi to data handover" or similar thing.
And yes, this should be in the request section (as you've posted), so we can force HTTP over the wifi connection. Similar to my Trigger HTTP request, which force the server to listen only at wifi interface (has been implemented in EAP 1.36.0).
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.