How to prioritize the device wifi connection even without internet?

Asked

Viewed 273 times

0

I have an application (Android/iOS) that runs on a local wifi network (which has no internet).

Because this wifi network does not have internet, the devices prioritize 3G/ 4G, and so my application (local API) ends up not working.

I tried to find if there was any way to programmatically disable the mobile data of the device, but without success because Google and Apple do not allow this.

Today, as an alternative, I just show a button for the user to enter the device settings, which I find a good solution, but not the best in my case, because my target audience are old people who have many difficulties in operating the device.

What I’d like is for you to somehow not have to go into your device settings. I know my scenario is complicated, but is there any alternative?

Note: It is mandatory the wifi network does not have internet, most of the public are elderly.

1 answer

2


Quiet to do that. you need to have on your wifi network, a web server that responds to requests from android and apple.

All devices (smartphones, computers, devices that access the internet) make an http request to a certain url to know whether or not there is internet on the network, the same request is used to identify how much has a captive portal (which requires registrations to free up the internet, like those you have at airports), but the difference with the captive portal is that it redirects the http request 302, and what you need is a web server (local) to respond to these requests

As an example I leave you the url an Apple device makes the request [http://captive.apple.com/][1] the answer is Success

HTML code of the answer:

<HTML><HEAD><TITLE>Success</TITLE></HEAD><BODY>Success</BODY></HTML>

EDIT: vc will need the following services running on it. Web, PHP and DNS, in addition to the basic.

1 - You must configure the DNS server to distribute ip on your internal network and pointing as DNS server itself, as it will solve the searched domains, pointing to the ip address of the machine that will answer the HTTP requests, in case it itself.

2 - You must create a virtual host on your web server to deliver the index.php page

Content index.php page to answer 200(has internet), and keeps the connection of devices.

<?php
    header("HTTP/1.0 200 OK");
?>

With this answer, all android or apple devices will stay connected to wifi network, because they found that has internet.

  • Alessandro, would have some example of how to build this server?

  • @Bueno edited my answer, and added an example to you. The idea and you research to be able to do, but as your difficulty I can go giving a few tips.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.