How can we get some data from android devices using python

good day everyone!!!

I am trying to get some information about android devices using python my goal is here:

  1. getting the model name(if possible)
  2. getting the manufacturer’s name (if possible)
  3. getting device id

I have tried to get a mac id using UUID

import uuid 
# printing the value of unique MAC 
# address using uuid and getnode() function  

result = (hex(uuid.getnode()))
print(result)

it is worked on my pc but on my android when I run it 0x142d276a20b2 it generated id but if I run it again generated different IDs all time. how can I get a static id of an android device?

You are probably getting randomly generated IDs - either from Android or from the uuid module.

From the documentation of uuid.getnode ():

… If all attempts to obtain the hardware address fail, we choose a random 48-bit number…

is it possible getting an unchanged id? serial number imie number or so on?

There are efforts to prevent you finger printing a device that the mobile OS’s implement.
Not sure you can do what you want.

understand. I have a ready project. I want to sell it but first I have to make sure it runs only on my customer’s devices. I managed to do that on pc but on android, I can not find any solution to identify the device.

BTW How are you running a Python code on Android? AFAIK there is no official full support of CPython for Android.

Maybe you need to study Android specific libraries or ask the authors making Python available on Android.

If there is no library available you should look for what you need in Android API and see how Python works with Android API. Maybe it is described here:
https://python-for-android.readthedocs.io/en/latest/apis/

running on termux bro

Then study your termux and learn what it provides to you. This is not anything Python-specific.

https://wiki.termux.com/wiki/Termux-telephony-deviceinfo