I am trying to read devices Ip address which has given from isp's not local.
How to get IP address of the device from code? In this checked answer gives me LAN Ip address for WI-FI and gives different IP address than whatismyip on the cell internet. I guess it may be local ip of operators service provider.
How can I internet Ip address what returns whatismyip from?
public static String getPublicIP() throws IOException
{
Document doc = Jsoup.connect("http://www.checkip.org").get();
return doc.getElementById("yourip").select("h1").first().select("span").text();
}
This one may work but I do not want to add any library just for it.
smallBig Edit: http://api.exip.org/?call=ip it returns just ip, how can I use it? And is it reliable and long life?