androidandroid-bluetoothandroid-10.0tethering

Get Bluetooth Hotspot Device IPs in Android 10


I need to get the IP of a device that is on the bluetooth tethering hotspot.

In Android 9 and below, I could get the ARP table by doing the following:

    var fileReader = new FileReader("/proc/net/arp");
    var bufferedReader = new BufferedReader(fileReader);

However, since Android 10 update, the above throws an exception

Java.IO.FileNotFoundException: /proc/net/arp: open failed: EACCES (Permission denied)

I believe this is due to the new Scoped Storage feature. Many internet blogs believe that adding android:requestLegacyExternalStorage="true" to the application tag in the manifest will fix that, however it did not.

I can't find any other way to get the IP of a connected device.

Is there any way to do this in Android 10?


Solution

  • In Android 10+, due to privacy changes in Android 10, it is impossible to read the "/proc/net/arp" file.

    It is not a question of enabling some sort of permission.