Search code examples
ionic-frameworkpush-notificationionic3apple-push-notificationsionic-native

Ionic native push registration format changed?


I am not sure why but it seems that the interface for push registration changed?

My app follows the logic from

https://ionicframework.com/docs/v3/native/push/

with

pushObject.on('registration').subscribe((registration: any) => console.log('Device registered', registration));

where registration used to be of below type

export interface PushDevice{
    registrationId: string;
    registrationType: string;
}

but now I am getting

{"registrationId":"{length=32,bytes=0x459ca46ab66f4fe790220809215176d6...21b3436d13e78c64}","registrationType":"APNS"}

registrationID used to be a string, but now is a dictionary. How shall I handle this ID now? I have to convert it to a push token somehow... What changed? I looked into the phone gap plugin code but I can not find it... https://github.com/phonegap/phonegap-plugin-push/blob/master/src/ios/PushPlugin.m


Solution

  • Finally found a lead. Seems this changed with the release of iOS 13.

    https://forums.developer.apple.com/thread/117545

    The Cordova push plugin has to be updated to v2.3.0 (I have not tested this yet), but my current version is failing because v2.2.3 is accessing the registrationId through a wrong method.

    https://github.com/phonegap/phonegap-plugin-push/issues/2832 https://github.com/proreact/phonegap-plugin-push/commit/486c8f206536995c80101487b0fed1502edd5754