source.rar source.rar - 4 months ago 60
Android Question

Determine device public ip

Does anyone know how I could get the public ip address of an android device?

I am trying to run a server socket (just experimenting with simple p2p).

This requires informing the local and remote users of each others public ip. I did find this thread How to get ip address of the device? which contains a link to an article (,304.html) that shows how to get the IP. However this returns the local ip when connected through a router and I would like to get the actual public IP instead.



Just visit and scrape it? is perfect for getting the IP, though the site requests you only hit it about once every 5 minutes.


WhatIsMyIp now exposes a developer API that you can use.