Hello. There is a program where I need to get the IMEI code of the device. I checked on many devices, but today I discovered that it can not be obtained on devices without 3G (and accordingly without a dialer). Got it that way.

TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); String l1 = tm.getDeviceId(); 

On such devices gives nothing. Has anyone encountered this problem and how can I get around it?

PS To be honest, I did not even find it in the device settings.

  • it is not there, where there is no WiKi radio module - LamerXaKer
  • I will even say more: where are two or more SIM cards, two or more IMEIs. Suggestive? :) - D-side

1 answer 1

Has anyone encountered this problem

Yes, for the most once it was unexpected.

PS To be honest, I did not even find it in the device settings.

That's right, Devices that do not have a SIM card slot do not have a radio module , and therefore do not have IMEI .

How can I get around it?

To use in this case instead of IMEI , some other pseudo- unique identifier. For example:

 String id = Secure.getString(getContentResolver(), Secure.ANDROID_ID); 
  • Is this id unique? - ahgpoug
  • one
    @ahgpoug but if you do not take into account the large number of Chinese handicrafts and the ability to change almost everything with the root, then it’s quite a unique one ... you should consider it in the context of the task you are solving. - ermak0ff
  • But then the IMEI code can not be considered unique because of the possibility of its replacement. - ahgpoug
  • one
    @ahgpoug here, so this is such a philosophical question about the uniqueness of something) - ermak0ff