Android Tutorial No-IP Android client - Access your device over the internet

Not open for further replies.

The following solution allows you to access your Android device over the internet. The device must be connected to a local network (with internet access) and configured properly.

You can use this solution together with HttpServer library to turn an unused Android device to a Http Server.

There are several challenges which we must overcome to get it working:
1. The local network public IP (wan IP) is dynamic. It changes from time to time.
2. The router needs to be configured to forward incoming connections to the device.

The DynamicIp service module overcomes the first challenge.
It is a simple No-IP updater client: Free Dynamic DNS - Managed DNS - Managed Email - Domain Registration - No-IP
No-IP is a free service that allows you to map a no-ip subdomain to your IP address. The updater is responsible for updating the IP. Every 30 minutes it checks whether the public IP has changed with another free web service: ExIp.Org - Home
If the IP address has changed then it updates the No-IP web service.

In order to use this service you should create a free account and pass the host, username and password to DynamicIp service:
If FirstTime Then
   Dim ni As NoIpValues
   ni.Host = ""
   ni.Username = "yyyyy"
   ni.Password = "xxxxx"
   CallSubDelayed2(DynamicIp, "Start", ni)
End If

You only need to start it once. It uses an internal timer to periodically check the IP address.

The second task requires you to configure your router:
1. The router should assign your device (based on the MAC address) a static local IP address.
2. The router should forward incoming connections on the relevant port to the device IP address.

There are many online tutorials about these tasks (such as: Free Help Forwarding Ports -

Note that you can also use raw sockets (Network library) though it will be simpler to use HttpServer in most cases.

The DynamicIp service is attached. It depends on HttpUtils2 code modules (which depends on Http and StringUtils libraries).


  • DynamicIp.bas
    2 KB · Views: 2,630


Licensed User
Hi, I'm also trying to access my Android device (which is running the HttpServer library) over the internet. I see there are helpful comments here back in 2014 that is out of service and suggesting an alternative; and also techknight's update above. Does anyone have experience of implementing this more recently who can advise on the services available now and/or any code samples?


Licensed User
Thank you for your help Erel.

I looked at whatismipaddress although I couldn't see how I can access it to update the dynamic external IP via the DynnamicIp service in b4a.

As a test, should it work without that step (just use the dynamic IP for a short period - if it doesn't change)? So far, I can't get that step to work.
I have forwarded a port to the device IP that is running the server code ( TCP 5555 and UDP 5555 in the router.
The device has a static IP.
If I type my external IP address into a web browser I get a message that the site can't be reached.
I currently have a variable in my application called SERVER_IP_ADDRESS that I set to the device ID when using my internal network.
SERVER_IP_ADDRESS = "" For example I can then call " & sb)"
Do I need to change this or does it stay as the device IP?

Sorry for the novice questions and thanks for any help.


B4X founder
Staff member
Licensed User
Longtime User
As a test, should it work without that step (just use the dynamic IP for a short period - if it doesn't change)?

So far, I can't get that step to work.
It is not so simple. This is why I suggested to start like this.

Please start a new thread for further discussion.
Not open for further replies.