Reputation: 32243
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()
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"
Upvotes: 0
Views: 838
Reputation: 1200
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.
Upvotes: 1