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.

MK_Dev
  • 3,291
  • 5
  • 27
  • 45
abdel
  • 91
  • 1
  • 1
  • 5
  • you can only send the Device id, not a registration id. – Aerrow May 30 '12 at 08:22
  • 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 ? – abdel May 30 '12 at 10:42

1 Answers1

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;
}
Bob
  • 22,810
  • 38
  • 143
  • 225