4

I have a website which will be accessed only on chrome browser. I want to fetch the devices's(mostly android tab) unique id. This value has to be similar to imei no. I want to obtain this value using javascript. Is there a way to obtain device's unique id using javascript.

user3230561
  • 445
  • 1
  • 10
  • 21
  • @Alex: Thanks for the link. But I am trying to obtain the unique id for a website. But the link refers to android app development. – user3230561 Dec 22 '14 at 09:20
  • Oh, my bad, I misread the question. Then it's not possible *and most likely illegal* – Alex Dec 22 '14 at 11:06

1 Answers1

-1

You can access device's uuid for this purpose

You can use Phonegap or MoSync

In Phonegap, you can use Cordova Device Plugin

  /* Android: Returns a random 64-bit integer (as a string, again!)
      The integer is generated on the device's first boot

   BlackBerry: Returns the PIN number of the device
         This is a nine-digit unique integer (as a string, though!)

   iPhone: (Paraphrased from the UIDevice Class documentation)
     Returns a string of hash values created from multiple hardware identifies.
     It is guaranteed to be unique for every device and can't be tied
     to the user account.
   Windows Phone 7 : Returns a hash of device+current user,
        if the user is not defined, a guid is generated and will persist until the app is uninstalled
   Tizen: returns the device IMEI (International Mobile Equipment Identity or IMEI is a number
    unique to every GSM and UMTS mobile phone. */

  var deviceID = device.uuid;

In MoSync, you can use Javascript API

<!DOCTYPE html>
<html>
<head>
<title>Device Properties Example</title>

<script type="text/javascript" charset="utf-8" src="js/wormhole.js"></script>
<script type="text/javascript" charset="utf-8">

// Wait for Wormhole to load
//
document.addEventListener("deviceready", onDeviceReady, false);

// Wormhole is ready
//
function onDeviceReady() {
    var element = document.getElementById('deviceProperties');

    element.innerHTML = 'Device Name: '     + device.name     + '<br />' + 
                        'Device Platform: ' + device.platform + '<br />' + 
                        'Device UUID: '     + device.uuid     + '<br />' + 
                        'Device Version: '  + device.version  + '<br />';
}

</script>
</head>
<body>
  <p id="deviceProperties">Loading device properties...</p>
</body>
</html>
Shabbir Dhangot
  • 8,954
  • 10
  • 58
  • 80
MasterMohsin
  • 158
  • 14