2

I am preparing android hybrid app using html5 and jquery. My project requirement is to fetch device IMEI number using JavaScript/jQuery. Please help me if any body have any idea about it. Thanks in advance!

LPOPYui
  • 799
  • 1
  • 9
  • 17
Ekta Shukla
  • 460
  • 3
  • 11
  • 25
  • 2
    you specifically want the IMEI number or any unique device identifier would do? – SHANK Aug 21 '13 at 11:32
  • http://stackoverflow.com/questions/8742850/how-to-get-imei-number-in-phonegap – Sasidharan Aug 21 '13 at 11:41
  • 1
    its answered in the following link too http://stackoverflow.com/questions/10157220/retrieve-phone-number-or-imei-of-a-smartphone – Chetan Shah Aug 21 '13 at 11:57
  • @SHANK: yea that would be helpful in itself since a lot of IMEI extraction use-cases just reduce down to having any unique identifier for the user's mobile device (e.g. Sybil detection). What do you propose to do? – Hassan Baig Sep 12 '18 at 16:49

2 Answers2

2

If you are talking about plain javascript and HTML, I do not think you are able to access the IMEI. This is for security reasons. You would be able to do this with a PhoneGap app or a "normal" native app.

Knut Marius
  • 1,588
  • 18
  • 40
-5

You should add the following permission into your Manifest.xml file:

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

And, with the help of following code you can get the IMEI no.:

TelephonyManager telephonyManager = 
(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);

telephonyManager.getDeviceId();

Note: In case of tablets or devices which can’t act as Mobile Phone IMEI will be null.

k0pernikus
  • 60,309
  • 67
  • 216
  • 347