0

I'm currently working on an application where the code uses the device IMEI number as a variable to store something in the DB. We need to see what device the reading originated from.

ie: String IMEI = telephonyManager.getDeviceId();

However, I'm not sure how this will behave on phones without network access, such as a wifi only tablet. Will is return a unique value? Will it return null?

I know there are alternatives to using IMEI, and I don't need any explanation on what alternative values I can use. I only need to know what will happen when I call this on a phone with no network access. Please do not provide suggestions on alternative IDs or anything other than what I have asked. I appreciate you taking the time to read this question.

Thanks, -Mark

Marcubus
  • 113
  • 1
  • 10
  • [Try out this link may be it will help you to get device IMEI number](http://stackoverflow.com/a/33471248/2183890) – Ahsan Kamal Jan 13 '16 at 05:08
  • "I know there are alternatives to using IMEI, and I don't need any explanation on what alternative values I can use. I only need to know what will happen when I call this on a phone with no network access. Please do not provide suggestions on alternative IDs or anything other than what I have asked. I appreciate you taking the time to read this question." – Marcubus Jan 25 '16 at 14:58

1 Answers1

0

You get null.

Just ran into this on an app I wrote 3 years ago, and only just converted to tablet format. I had forgotten we were using IMEI (against the advice you and I both received ;-) ) and we started sending a whole bunch of null device IDs to the server.

Sadly it took a whole lot of network logs before I tracked it down to that little hack.

Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255
  • Thanks for taking the time to answer. I will have to make changes to accommodate. – Marcubus Apr 01 '14 at 18:16
  • I wish I could give you recommendations based on the various alternatives, as to what works well, but we haven't implemented an alternative yet. Client has placed this on the backlog for further server development, and in the meantime we are excluding tablets from the roll-out. – Richard Le Mesurier Apr 02 '14 at 06:42
  • what did you use instead IMEI? – jcesarmobile Apr 15 '14 at 06:32
  • 1
    @jcesar I have not implemented the fix yet (we have removed tablets from out target audience for now). However, check out info at http://stackoverflow.com/questions/2322234/how-to-find-serial-number-of-android-device and http://android-developers.blogspot.com/2011/03/identifying-app-installations.html – Richard Le Mesurier Apr 15 '14 at 07:13