0

I'm generating a key for obfuscate information.

That key must change between devices so for the generation I was using:

  • Secure.getString(getContentResolver(), Secure.ANDROID_ID)
  • TelephonyManager.getSimSerialNumber()
  • TelephonyManager.getDeviceId()
  • A random persistent String generated if all of the options above are null

But testing I realised that since TelephonyManager.getSimSerialNumber() changes with the SIM in the device (and in airplane mode always return null) the key also changes and the obfuscated data cant be recovered.

My question is: Does TelephonyManager.getDeviceId() return always the same value (null or a value but always the same result)?

Note: I tested and it returns a valid value for me even in "Airplane mode"

Addev
  • 31,819
  • 51
  • 183
  • 302
  • [See this question](http://stackoverflow.com/questions/2785485/is-there-a-unique-android-device-id) for info related to unique ID. It is important to note that the ID you are pulling can also change when a device is factory reset. – FoamyGuy Feb 14 '13 at 17:12

1 Answers1

1

Assuming that the device in question is not rooted (as it allows the user to change most of the unique strings of the device) TelephonyManager.getDeviceId() should return the IMEI number on GSM network - This is linked to handset not SIM and so, it will not change.

Nirav Zaveri
  • 687
  • 1
  • 9
  • 28
gheese
  • 1,170
  • 1
  • 11
  • 17
  • 3
    Rooted device users may be able to change this value, and alternative ROMs might allow the user to change this value. – CommonsWare Feb 14 '13 at 17:13