Tom Pryer

Greenhorn
+ Follow
since May 31, 2021
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
4
Given in last 30 days
4
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tom Pryer

Stephan van Hulst wrote:Welcome to CodeRanch!

Why do you need the MAC address? Programmatic access was removed for a reason.



I'm making a network scanning app on Android to keep track of devices on your network with WOL support as well as other features.

Tim Moores wrote:There are good reasons for wanting to get the MAC addresses of networked devices - Wake-On-Lan for example.

The output of the "ip" command (which you can run via Runtime.exec) has all kinds of useful information. "ip addr" has more data than you'll get from NetworkInterface, for example. "ip neigh show" has MAC addresses of known hosts on the same network, especially after doing a subnet scan (meaning, making connections to those hosts).

Android API 30 curtails the "ip" command, unfortunately, also in the name of protecting MAC addresses. I have not found a workaround, so it may be gone for good.



Thank you! In what way does API 30 restrict the ip command? I can't seem to find anything about this in release notes.
1 week ago
Previously, I have used proc/net/arp to find other devices on the network. API 29 does not give an application access to this file any longer. Also, it is more difficult to find the host device's MAC address. I am able to find device IP addresses on the current network by scanning for services where devices will broadcast themselves. From this I am able to make a list of IP addresses active on the current network. How do I resolve a MAC address on Android after API 29. I have tried:  



but this will only get the MAC address from the device I run it on. If I have an IP address of another device on the subnet, how can I resolve its MAC address?

1 week ago