Android i can see my device ID in Developer Options, but not in my coding

StackOverflow https://stackoverflow.com/questions/22158198

  •  19-10-2022
  •  | 
  •  

Вопрос

enter image description here

final TelephonyManager tm = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
        final String tmDevice, tmSerial, androidId;
        tmDevice = "" + tm.getDeviceId();
        tmSerial = "" + tm.getSimSerialNumber();

TextView lblVersion= (TextView)findViewById(R.id.txtDeviceID);
        lblVersion.setText("Device ID : "+tmDevice);

i get device ID is null, why?

Нет правильного решения

Другие советы

There are many things which people call a "device ID". Development device ID is different from what you get from TelephonyManager.getDeviceId() (and also different from Secure.ANDROID_ID). This Google Groups post seems to have done some research and narrowed it down to this code and related comment:

Returns the device identity that verifiers can use to associate their scheme to a particular device. This should not be used by anything other than a package verifier.

In short, don't try to use the Development Device ID. Use a different ID instead.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top