2021年2月6日星期六

Find Country Name from IP Adress through IPStack

I have the code for finding the IP address through Wifi-Manager (Android - Java).

WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);        int ipAddressInt = wifiManager.getDhcpInfo().netmask;      byte[] ipAddress = BigInteger.valueOf(ipAddressInt).toByteArray();      InetAddress inetAddress = null;      try {          inetAddress = InetAddress.getByAddress(ipAddress);      } catch (UnknownHostException e) {          e.printStackTrace();      }      assert inetAddress != null;      String finalIpAddress = inetAddress.getHostAddress();        Log.i("Ip", finalIpAddress);  

Now, I want to find the country name through that IP address through a service called IPStack. Can someone please guide me to find the country name through that IP address through IPStack or any other way?

https://stackoverflow.com/questions/66084234/find-country-name-from-ip-adress-through-ipstack February 07, 2021 at 11:19AM

没有评论:

发表评论