0

I am relatively new to Android/Java programming, but I am trying get up to speed to develop a new application for work.

I am looking for insight on developing an Android snippet that will show me the same IP addresses listed in the Settings menu, with a single click. I have worked through the code provided at How to get IP address of the device from code?, but this code is not providing the same IP address found in settings.

GrandMasterD
  • 61
  • 1
  • 1
  • 8
  • Can you show us what is the difference between the addresses it is listing and which ones are shown in settings? – m0skit0 Jan 31 '19 at 18:10
  • Sure, the application is generating output of "fe80::eca5:eff:feec:1cba%dummy0", where my settings shows the IPs of 100.70.247.184 and 2600:100e:b112:249a:4cbe:f0dd:4ceb:55fa. Side note: I believe that "dummy0" is the interface being referenced by the original code. I had thought about trying to search by interface name to get the IP, but I'm not sure what the interface name would be. – GrandMasterD Jan 31 '19 at 18:47
  • 1
    The question you link to has several answers which return different IP addresses based on how they get it. A device can have multiple addresses some even unknown to it. – Robert Jan 31 '19 at 19:00
  • Yeah, that's another reason why I wondered if there was a way to grab just the mobile carrier provided IP based on the interface name. Is there a standard for that in Android? Or is there a better way to go about doing it when I am only looking for the IP provided by the carrier? – GrandMasterD Jan 31 '19 at 19:05
  • I've been able to modify one of the code snippets from the link in my original post to get IPv4 working, but IPv6 is still not providing the right address. – GrandMasterD Feb 01 '19 at 00:03

0 Answers0