在Android中获取deviceid可以通过如下代码实现:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/> TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); String deviceId = telephonyManager.getDeviceId(); 需要注意的是,获取deviceid需要READ_PHONE_STATE权限,如果权限未授权,需要在运行时进行权限请求。