Bạn có cần điều này không?
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;
}
bạn chỉ có thể gửi id thiết bị, không phải là id đăng ký. – Aerrow
tôi đã thử với id đăng ký và nó hoạt động nhưng tôi không tìm thấy làm thế nào để gửi một thông báo đẩy với id thiết bị. Có bạn có một liên kết? – abdel