get MAC address on android

245 views
Skip to first unread message

Aritra Das

unread,
Feb 4, 2016, 8:08:48 PM2/4/16
to Kivy users support
I am looking for a way to get a unique machine fingerprint on android. MAC address would be best. How do I get it using kivy? I tried getnode() from uuid, but doesn't work(gives new output everytime it is run).

qua non

unread,
Feb 4, 2016, 8:58:18 PM2/4/16
to kivy-...@googlegroups.com
from plyer import uniqueid

On Fri, Feb 5, 2016 at 6:38 AM, Aritra Das <dodo....@gmail.com> wrote:
I am looking for a way to get a unique machine fingerprint on android. MAC address would be best. How do I get it using kivy? I tried getnode() from uuid, but doesn't work(gives new output everytime it is run).

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aritra Das

unread,
Feb 5, 2016, 7:32:44 AM2/5/16
to Kivy users support
is this uniqueid the MAC?

niavlys

unread,
Feb 5, 2016, 7:54:24 AM2/5/16
to Kivy users support
nope, it's a wrapper around that:

http://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID

neither unique, nor consistent over time.

ZenCODE

unread,
Feb 5, 2016, 10:53:34 AM2/5/16
to Kivy users support
@niavlys. Interesting. Thanks. Found this summarizes the issue nicely:

Aritra Das

unread,
Feb 5, 2016, 11:14:55 AM2/5/16
to Kivy users support
So mac is unusable as a unique id. So is this plyer.uniqueid . So what other option do I have? My main issue is the app has to work on windows linux(desktop) and android(hence kivy).

ZenCODE

unread,
Feb 7, 2016, 1:13:40 AM2/7/16
to Kivy users support
I think you need to accept a true unique ID is just not possible. The link above explains why it's a hard problem. So then we need to look at a 'unique enough' i.e. the best available solution. plyer.uniqueid is probably your best bet and covers your required platforms. From the docs:

    Returns the following depending on the platform:
    * **Android**: Android ID
    * **OS X**: Serial number of the device
    * **Linux**: Serial number using lshw
    * **Windows**: MachineGUID from regkey

qua non

unread,
Feb 7, 2016, 2:46:31 AM2/7/16
to kivy-...@googlegroups.com
from jnius import autoclave
Context = autoclass('android.content.Context')
telephonyManager = cast(
'android.telephony.TelephonyManager', getSystemService(Context.TELEPHONY_SERVICE))
imbed = telephonyManager.getDeviceId()

And you should add the following permission into your bulldozer.spec:

permisions= ........,READ_PHONE_STATE
of course some phones have 2 sims = 2 IMEI numbers, this could also give you a Null as
result if correct permissions are not given.

Warning this is not tested,  please test before using 

Aritra Das

unread,
Feb 12, 2016, 5:28:17 PM2/12/16
to Kivy users support
thanks, this works!
Reply all
Reply to author
Forward
0 new messages