Kivy get hostname and MAC address from APK

61 Views Asked by At

I have developed an kivy/python 3.11 app that scans the local wifi network for devices. This works like a charm however,my issue is when I try and query the hostnames and macs of the LAN connected devices via the APK loaded on my phone, it only returns 192.168.0.25 = localhost,127.0.0.1. If I load the same kivy app in a debugger in windows I get the expected result i.e 192.168.0.25 = DESKTOP-72SJK0R', [], ['MAC ADDRESS']

The commands I use are below for network queries

socket.getfqdn(hostname) # Returns host name on windows / i.p only on android 
socket.gethostbyaddr(socket.gethostname()) # Used to grab hostname and MAC 

So my question is how does one perform the above queries using kivy on an android device. I have tried various third party libs such as getmac (not supported), netifaces/uuid (to old for python3.11), subprocess and arp calls (pointless as windows only).

Is there a way to get mac,hostname via ip of LAN devices on an Android device using kivy/python?, or is there a way to query ARP tables from the apk? If not I guess I will need to port this app to native java.

Thank you

0

There are 0 best solutions below