Closed dannywillems closed 7 years ago
That error appears when something is not configured properly, might be your apple certificates on firebase console or your provisioning profile doesn't include the push notifications, or you didn't use the same bundle identifier on the app and on firebase. Are you testing on Xcode 7 or Xcode 8?
@jcesarmobile Can't be that because it's working with another plugin. If there's an error with the bundle identifier, it is another error message. I'm using Xcode 7.
I could reproduce your issue and it was because I didn't upload the certificate .p12 to the firebase console, but as soon as I uploaded it, it worked, I received the FCM token push instead of the Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 "(null)"
@jcesarmobile I uploaded the certificate and it's working with the plugin cordova-plugin-fcm
.
I get the FCM token and when I send a notification with my server (using ocsigen-start, see PR 199), I receive a successful message, but no notifications on the device, although I receive the notification on my Android device.
@jcesarmobile Is the production certificate mandatory? I suppose the iOS options are the same so:
var push = PushNotification.init({
ios: {
senderID: "xxxxx",
gcmSandbox: true
}
});
suffices, no?
You also have to pass alert: "true", badge: "true", sound: "false" to the init method
var push = PushNotification.init({
ios: {
senderID: "xxxxx",
gcmSandbox: true,
alert: "true",
badge: "true",
sound: "false"
}
});
production certificate is mandatory only to test on production, you don't need to upload it to make it work
@jcesarmobile Why is it said it's optional in this case...?
@dannywillems Use FCM branch https://github.com/phonegap/phonegap-plugin-push/tree/FCM v2.0 branch doesn't work with FCM.
@Eccenux In the discussion about FCM support, it is recommended to use v2.0.x
...
@dannywillems You're right. v2.0.x
branch has some code for iOS Firebase support, while FCM
branch doesn't even have proper token getter. Still I was unable to get iOS to work.
@jcesarmobile Are you sure it's working on iOS...? We tested a lot of time with certificates but nothing works.
I have the same issue, always receive invalid registration token
@tranhai It's not the same issue than me because I have a success response from Google. Your issue comes from a bad token you use server-side.
So we succeed by giving a title and a body in the notification key. But the notification on Android has changed. @jcesarmobile Do you have any why? Is it mandatory to send different payload for different platforms?
@dannywillems I tested sending the push notifications from the Firebase console instead of using my own server to send the push, so I didn't really use any payload to test, it's generated from the console. I'll test using my own server and let you know
it works for me on ios, I added development certificate to firebase and I'm using v2.0.x branch
push = PushNotification.init({
android: {
senderID: SERVER_KEYS.FCM_SENDER_ID
},
ios: {
senderID: SERVER_KEYS.FCM_SENDER_ID,
gcmSandbox: SERVER_KEYS.BUILD_ENVIRONMENT === 'development',
alert: 'true',
badge: 'true',
sound: 'true'
},
windows: {}
});
to send notifications I'm using https://www.npmjs.com/package/fcm-push
@pramodwerea no, it's not possible as v2.0.x uses hooks and phonegap build doesn't support them
This thread has been automatically locked.
Expected Behaviour
Notification in iOS
Actual Behaviour
Nothing
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
iOS 9
Cordova CLI version and cordova platform version
Plugin version
branch
v2.0.x
Sample Push Data Payload
Just a title and a message in a data section.
Sample Code that illustrates the problem
It's in OCaml with a binding and other libraries.
Logs taken while reproducing problem
I suppose it comes from:
It's working on Android.