Can I get an Android device ID through a mobile website?

19,571

Solution 1

No, this is not possible. Even for native apps, device identity information is safeguarded behind the READ_PHONE_STATE permission.

As websites cannot request permissions, you cannot retrieve this information outside of an app.

Solution 2

You said you need a unique(ish) ID on a website.

Look into UserAgents: http://en.wikipedia.org/wiki/User_agent which will tell you what kind of device/browser is viewing your webpage

And you can also retrieve the IP address of the user, which may change in future requests to your website.

You could also attempt to store a cookie, but the user may delete their cookies at any time.

For specifics on how to get these, it depends on what your web site is built with.

Share:
19,571
Kalina
Author by

Kalina

Updated on July 20, 2022

Comments

  • Kalina
    Kalina almost 2 years

    Is it possible to get a device's telephony ID, MAC Address, serial number, and/or Android ID through a mobile website?

    That is, not through a downloadable app, but through a link that the user goes to in the browser on their mobile device?

    If so, how?

  • Kalina
    Kalina over 11 years
    Isn't Telephony the only ID that requires READ_PHONE_STATE?
  • Raghav Sood
    Raghav Sood over 11 years
    IMEI/ESN, and the WiFi/BlueTooth MAC addresses require the READ_PHONE_STATE permission
  • Kalina
    Kalina over 11 years
    Thanks! IP address and cookies are out, because I need a more persistent identifier that is also consistent between the mobile app and the mobile website. I will look into UserAgents.
  • Bryan Denny
    Bryan Denny over 11 years
    @TheBeatlemaniac Just note that a UserAgent will look something like this: Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; SCH-I535 4G Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30; you could possibly have multiple users with the same UserAgent if they use the same phone and browser and OS
  • developarvin
    developarvin over 2 years
    Is there a citation for this I can use as a source?