I am new to python
and kivy
. I want to get the IMEI and phone numbers from an Android device. I tried the code from kivy/plyer/issues/107 but I get Device_id not the IMEI number.

- 30,437
- 17
- 118
- 169

- 1
- 1
- 3
1 Answers
As you can see in the post, it works only on phones which means that on tablet you'd get nothing. If you are looking for something like "anchor"/constant on your device, I'd recommend you getprop ril.serialnumber
from shell that should work on both phones and tablets.
Otherwise, again with shell you can use this method and you can avoid using plyer or other packages if you don't work them and you want only the constant.
To call the command use: subprocess.check_output()
Edit:
That's weird, in your comment it behaves like it needs a root access to that command. It should look like this: subprocess.check_output(['getprop','ril.serialnumber'])[:-1]
or subprocess.check_output(['service','call','iphonesubinfo','1'])
This gist has python code to parse the service call
command output.

- 30,437
- 17
- 118
- 169

- 11,310
- 10
- 44
- 90
-
thank you bro, cant you give me example code?because i got erorr OSError: [Errno 13] Permission denied in adb logcat – Barry Vasyah Mar 29 '16 at 09:11