简体   繁体   中英

phonegap-plugin-push gets an APN token that is not an FCM token

I'm creating an android/ios application using ionic 1.

A list of the version.

cordova: 7.0.1
ionic: 2.2.2
ios-deploy: 1.9.1 
ios-sim: 6.0.0
node: v8.3.0 

A list of the plugins I used.

cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.7 "Console"
cordova-plugin-device 1.1.6 "Device"
cordova-plugin-facebook4 1.7.4 "Facebook Connect"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-file-transfer 1.6.3 "File Transfer"
cordova-plugin-firebase 0.1.24 "Google Firebase Plugin"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-ignore-lint-translation 0.0.1 "cordova-plugin-ignore-lint-translation"
cordova-plugin-image-picker 1.1.1 "ImagePicker"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.3 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
cordova.plugins.diagnostic 3.5.0 "Diagnostic"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-push 1.10.5 "PushPlugin"

Issue

I am implementing push via fcm. Android works fine. However, iOS has an issue. If I check my DB, android phones will get the fcm tokens normally, but ios seems to get APN tokens. like below

device_id: F62304A7-19EC-49D9-BFC8-922D254D3DFA
registration_id : 0876b8eb6a6e1eb525e164ced4552bcd881d2e219b13f89ff1f4472c9d69695e    

Has anyone solved the same problem with you?

Thanks

I solved this issue.

I added the following code to config.xml.

Then I can get the FCM token normally.

<platform name="ios">
  <resource-file src="GoogleService-Info.plist" />
</platform>

By default, the FCM SDK generates a registration token for the client app instance on initial startup of your app. Similar to the APNs device token , this token allows you to target notification messages to this particular instance of the app.

I am sure you will get the push notification if your fire it from fire base console..

Get more info from Here

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM