- Forum posts: 2
Jan 17, 2018, 9:01:48 PM via Website
Jan 17, 2018 9:01:48 PM via Website
I have an Android app that needs to access a shared folder on a Windows PC on the local network. Accessing the Windows server by name works well in some environments but in others (depending on the router in use) name to IP resolution doesn't work. Research indicates there is a generic Android problem resolving local device names in some circumstances. The problem is not specific to my app. In those environments where it fails, other apps also exhibit an inability to resolve local device names.
However, I observe that many file manager apps are able to scan the local network and deduce names for all "live" local IPs. I would like to be able to emulate this behaviour in my app - ie. scan all possible local IP addresses to see if I can get a host name for the device at each IP address.
Unfortunately, in those environments where local name resolution fails, Android interfaces like getHostName aren't any more successful, returning just the IP address passed, not the host name.
Can anyone tell me how to poll an IP address to find the host name for the device (if any) at that IP?
Please note that solutions requiring me to change my Android device's configuration are not acceptable. This app is for others to use. It would be unreasonable of me to expect my end users to start fiddling with their device settings and such adjustments would be beyond the technical capabilities of many of my target users.