How can i get my registration ID device
Asked Answered
C

1

9

What do I need to send a push notification for android (like iOS I need a device udid to send a simple push)?

And if I need to get the registration id of my device how can i get it?

Thank you.

Circumfuse answered 30/5, 2012 at 8:14 Comment(2)
you can only send the Device id, not a registration id.Daria
i tried with the registration id and it work but i dont found how to send a push notification with the device id .So have you a link ?Circumfuse
R
1

Do you need this?

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;
}
Repository answered 30/5, 2012 at 8:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.