我需要发送安卓推送通知,需要什么(就像iOS一样,我需要设备UDID来发送简单的推送通知)?
如果我需要获取我的设备的注册ID,我该如何获取它?
谢谢。
我需要发送安卓推送通知,需要什么(就像iOS一样,我需要设备UDID来发送简单的推送通知)?
如果我需要获取我的设备的注册ID,我该如何获取它?
谢谢。
您需要这个吗?
public static String getDeviceID(Context context) {
final TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
final String tmDevice, tmSerial, tmPhone, androidId;
tmDevice = "" + tm.getDeviceId();
tmSerial = "";// + tm.getSimSerialNumber();
androidId = ""
+ android.provider.Settings.Secure.getString(
context.getContentResolver(),
android.provider.Settings.Secure.ANDROID_ID);
UUID deviceUuid = new UUID(androidId.hashCode(),
((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
String deviceId = deviceUuid.toString();
return deviceId;
}