9

Android のプッシュ通知を送信するには何が必要ですか (iOS のように、単純なプッシュを送信するにはデバイスの udid が必要です)?

デバイスの登録 ID を取得する必要がある場合、どうすれば取得できますか?

ありがとうございました。

4

1 に答える 1

1

これが必要ですか?

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;
}
于 2012-05-30T08:47:01.757 に答える