arica
January 12, 2022, 9:38am
1
When I test the push through the APNs push notification tester, “Couldn’t send push notification.Status: 400 (BadDeviceToken)” occurs.
I also checked the Push token in User information, and I also checked the tokens on the device. What is problem?
Translated into a translator *
Tyler
January 13, 2022, 4:50pm
2
Hi @arica ,
Welcome to the Sendbird Community. Can you show me how you’re registering tokens on the Flutter SDK? With Flutter, it sounds like you might be registering an FCM token for APNS or vice versa.
arica
January 17, 2022, 12:48am
4
Thank you for your welcome, @Tyler
firebaseMessaging.getToken().then((token){
if (token != null) sendbird.registerPushToken(type: Platform.isIOS ? PushTokenType.apns : PushTokenType.fcm,token: token);
});
I’m registering token with the code above.
Tyler
January 18, 2022, 1:51am
5
For iOS, you would need to obtain an APNS token, not a FCM token. Sendbird only sends tokens to iOS devices via APNS.
Woo
January 19, 2022, 2:50am
6
I believe firebase has a method to retrieve apns token, you may want to use it for iOS instead getToken
arica
January 19, 2022, 6:11am
7
Using getAPNSToken, I’m getting a push from the APNs push notification tester and the real app. Thank you. @Woo @Tyler
But I can’t get an app push on the foreground. What should I do about this? I am sorry that I know very little as a beginner.
“Send to devices both offline and online” have been activated.
“userNotificationCenter” was also overrided at AppDelegate, but it was not delivered.
Woo
January 19, 2022, 7:13am
8
For foreground push, our server does not support for flutter yet and we are about to add this soon! Thanks for your patient.
arica
January 19, 2022, 8:42am
9
OK, thank you! X-D
+) I solved it by making a local push in OnMessageReceived!
1 Like