网络请求的时候需要根据设备号id传参,但是服务端后台收到的有时候为空,服务端的存储就为1个0 。而手机设备号获取与手机本身注册的网相关
本人经测试情况魅蓝note5、1:全网通、2张联通卡、获取结果为IMEI1的值。
通过查询API调用getDeviceId()源码可知
通过getDeviceId获取的为IMEI和MEID和ESN
/**
* Returns the unique device ID, for example, the IMEI for GSM and the MEID
* or ESN for CDMA phones. Return null if device ID is not available.
*
* @deprecated Use (@link getImei} which returns IMEI for GSM or (@link getMeid} which returns
* MEID for CDMA.
*/
@Deprecated
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
public String getDeviceId() {
try {
ITelephony telephony = getITelephony();
if (telephony == null)
return null;
return telephony.getDeviceId(mContext.getOpPackageName());
} catch (RemoteException ex) {