Android Question Captive Portal

Blueforcer

Well-Known Member
Licensed User
Longtime User
Hello everyone,

I'm currently working on a project using B4A where I've set up a mini web server as well as the function to start a wifi AP.
My goal is to automatically prompt users to open a specific webpage as soon as they connect to the WiFi hotspot provided by the device.

I understand that this typically involves creating a sort of captive portal, where the device intercepts network requests and directs them to a predetermined page until the user completes a specific action (like logging in or accepting terms). However, I'm unsure how to handle the network configurations and DNS settings within B4A to achieve this.

BTW: I have root access on this device.
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
Kind of.

i managed to forward every request to my B4A webserver

B4X:
 Dim s As SuShell
    s.Execute("iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8321")
    s.Execute("iptables -A FORWARD -p udp --dport 53 -j ACCEPT")
    s.Execute("iptables -A FORWARD -p udp --sport 53 -j ACCEPT")
    s.Execute("iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to-destination 192.168.43.1")
    s.Execute("iptables -P FORWARD DROP")

and when a client connects to the hotspot, my webserver recognized a request from it. Unfortunally it does not open the webpage.

But if I understand your article correctly, the web server must support https. Which neither the httpServer from erel nor xHttpServer supports. :(
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
Https in general should not be the problem. see
but currently we doesnt have libs wich support that.

B4J is out of the question, as it is an industrial Android HMI that is used for measuring and controlling pools.

But then the user has to enter the URL manually, which isn't too bad.
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User

This one have SSL support.

Seems like other already tried but they give up
 
Upvote 0
Top