Accessing Website On Offline Network With Android 11+ - android

I have a webserver that is running on a network that is not connected to the internet.
The webserver serves up a website.
When I connect an android phone to it, I am able to run the website that is on the webserver
But with certain phones that are running Android 11 I need to disable the mobile data on the phone before it will try to access the website over wifi. It seems the phone will not try to request the url on the wifi network because it doesn't have internet, so it defaults to using the 4G/5G Cellular internet connection. This is too bad, because I would like the phone to use the wifi connection.
I would think that perhaops I could "force" the phone to use the wifi connection by typing the IP address in the browser's URL bar (eg. http://192.168.211.1/index.php), however it seems that even with the "local ip" it will still try to use the 4G/5G network instead of the "offline wifi" network.
The only workaround I have found is to disable moblie data on the phone, but this is not ideal.
I would think that some IoT devices would have an offline webserver used for configuation/control.
Is there a certain port or settings I should be using?
Is there a designated port that the browser/OS would expect to be on an offline network?
Basically, how can I make the phone use the wifi, even though the wifi is not connected to the internet?
Thanks so much for any pointers!

Related

Connect Android to laptop without Internet connection

Say I have a laptop (Windows 10) and an Android phone. The laptop does not have an internet connection and the Android does not have an internet connection.
I have an Xamarin app that uses a C# Web API that is deployed to the laptop (for testing). How can I connect the mobile to the laptop without any form of internet connection? I believe I have two options:
1) USB cable
2) Bluetooth
I believe I have to install a wireless hotspot on the laptop and then a reverse tethering on the Android.
Have I understood this correctly? Do I have to do this regardless of whether I use a USB cable or a Bluetooth connection.
Tethering is the name given to a mobile that acts as a hotspot. It make use of a network interface (Wifi, Bluetooth, USB port acting as Ethernet...) to share internet connection through the selected interface.
As you'll note I'm not incluiding mobile data in the list. Mobile data is used to connect to Internet. So your mobile is capable of connecting to internet via mobile data and share it via any other interface, i.e. Wifi, Bluetooth and USB (Ethernet)
At least in my mobile im able to just enable Tethering configuring it from Settings -> Wifi connections -> Share internet. Here I can switch on/off the desired interface: USB, bluetooth or Wifi. I can enable just one, both or even all of those
As far as I know a Xamarin app is an android app that embeddes a website and, optionaly but highly common, uses a server as an endpoint (your laptop in this case), also known as API.
So as you ask you don't want to have internet connectivity, all the connections must be made in a local network. To do so you could just enable tethering and turn off mobile data on your mobile. Then on your laptop, connect to your new network over wifi, enable ethernet or connect via bluetooth, depending on your choose.
Of course, you'll have to handle firewall on your laptop to ensure connections are made successfuly. But you should be able at last to ping each other.

Is it possible to access an HTTP server deployed on an Android phone from another device on the same network?

I am using the NanoHttpd library to set up a server. It is currently serving a 'Hello World' HTML page.
It is accessible from the browser of the phone on which it is deployed but not on other phones or laptops on the same WiFi.
For example, http://10.54.92.228:8080 is accessible to the browser of the phone on which the server is deployed. But, is inaccessible to other devices over the network. Is there any way to enable incoming connections ?
I am working on a similar project, I have to host files over WIFI on an android device which is accessible to anyone on the same WIFI network.
The web server is working as I want.
I think the problem is with your IP-Address of the server.
For a WIFI network, the network should be in the range of 192.168.137.XXX.
What you are inputting is the global ip of the device on which your server is.
Check you local ip, and enter it with the port number and it will work.
Ping me if you need any help.

Multipath TCP on Android / IPhone

I have a device that creates a WiFi network that is not connected to the internet. This device hosts a website using IIS. To operate the device, a smartphone connects to the WiFi and browses the site. The smartphone needs to get data from an api (internet) and pass it to the website on the device.
I have tried to remove the default gateway setting from the DHCP server on the local WiFi, but this is not permitted on the device.
I have not been able to find an app that will allow both WiFi and Cellular data to be used simultaneously.
If I were to allow the device to connect to a hot spot that the smartphone creates, the smart phone cannot access the device's WAP.
The next option I'm considering is to toggle the WiFi Off and On during the process.
I'm wondering if anyone has another solution to this issue?

Getting android device galaxy S2 work like an emulator

I want to test my app on a android device, I have a local webservice (ASP.net) that is hosted in my laptop in local, when I plug my device, the app works in it but it cannot receive data from my local webservice, how can I get the data sent to the device just like in the emulator
PS: the app works properly in the emulator.
thank you
The emulator uses your laptop's network interfaces, hence it can access webservice directly. Your device needs to connect to your laptop via its own connectivity options (celluar network, WiFi, possibly bluetooth).
I have a few ideas how to get there:
If you have got a WiFi router and both your laptop and phone connect to it - that's pretty straightforward: just expose webservice to address that can be seen within network and use it on your phone.
If you've got an external IP - just use that address when phone is connected to network.
Set up a WiFi access point on your laptop and connect your device with it
Check these URLs how to set up a hosted network (hotspot) on Windows 7:
Hosted network documentation in MSDN
Hosted network tutorial
You might try Bluetooth and PAN.

Android "localhost" sockets fail when no data connection?

I'm designing an Android app that will require the use of a web server on the local device. I've been trying out some different servers for this purpose. At present I haven't written any code or run anything in an emulator, just played around with the servers on my actual phone, and I'm observing some strange behaviour.
Whenever I try to connect to the local web server, and I have WIFI switched off, the HTTP request fails. If I switch WIFI on, it succeeds.
Depending on which address I use, I get different results: using localhost or 127.0.0.1, I get connection refused when WIFI is off; using the current 10.X.Y.Z address I get a timeout. Both addresses work when WIFI is on.
I have tried this with xWS, PAW and i-Jetty: the behaviour is consistent. WIFI on, I can connect to the local web server; WIFI off, I can't.
I am using the default "Internet" browser on Android 2.3.3 on a Samsung Galaxy S (GT-I9000).
Does anyone know why this is? Is it a simple question of a setting somewhere I need to change, or what's going on?
Cheers,
/Uffe
Can you change the network interface the web server is connected to?
The default setting is probably something like eth0 or wlan0, if you change it to lo it could work.
You are asking why when you turn off your wifi, there is no connection to the 10.0.0.2 (Your computer's localhost) and when you turn it on, there is a connection?
Very simple. Wifi off - NO INTERNET connection. The device emulator is a separate OS inside your computer's OS. When you turn off your WIFI there is no route to the host (your computer) - there is no internet
I have now tested with my own simple client, and with Opera - and it works.
So in fact this is an issue not with the IP stack but with the default Android browser, or possibly with the settings enforced by the manufacturer (Samsung) or carrier (Telenor Sweden). Either way there is a workaround: use Opera instead.
Still don't know why it doesn't work with the default browser, but I'll mark this question answered.

Categories

Resources