Reading the ARP table and accessing the MAC address of devices on network is working just fine. But when I upgrade the targetSDK to 30, suddenly the "ip neigh" command won't return a value anymore. I'm guessing this has something to do with the restrictions on android. Is there any way to fix this issue?
-
Does the app crash, or do you get some sort of invalid value? If it crashes, check the logcat to see what the problem is. – atrocia6 Jan 28 '22 at 13:46
-
Thanks for you response, we can't access arp table in android 11. Error is: java.io.FileNotFoundException: /proc/net/arp: open failed: EACCES (Permission denied) – presita jadav Jan 31 '22 at 08:27
1 Answers
I see you've asked this before. Others have asked similar questions as well, and it seems that there is no real solution:
Android 10 introduces several privacy-related restrictions that disallow apps to access certain information that could be potentially misused for fingerprinting and data collection. One of among them is the restriction on access to
/proc/net
filesystem on devices that run Android 10 or higher, apps cannot access/proc/net
, which includes information about a device's network state. Apps that need access to this information, such as VPNs, should use the NetworkStatsManager or ConnectivityManager class.
The current APIs in Android doesn't allow apps to access the ARP cache. I see a bug is raised in Google issue tracker that is currently in the below status - https://issuetracker.google.com/issues/130103885
Status: Won't Fix (Infeasible) We've passed along your input to our internal teams, who are evaluating it for a future release. We're closing this issue for now, and thanks for sending us your feedback!"
https://developer.android.com/about/versions/10/privacy/changes#proc-net-filesystem
Related thread [ Acccess to /proc/net/tcp in Android Q ] - https://stackoverflow.com/a/58501039/4694013

- 319
- 1
- 8
-
I do see some Android networking app managing to get the MACs of remote hosts even on my Android 13. At least one of them did it's own ARP calls though (checked in Wireshark)- either with an own implementation or using some Android APIs. – Andreas Dahlström Mar 25 '23 at 16:26