我正在使用Sendbird和cordova构建聊天应用程序,但是它们似乎为除Javascript之外的所有平台提供推送通知API。他们为Android, ios,Unity和.Net + Xamarin.提供了推送通知。因为我是新手,所以不确定JS API是否不完整或者他们有没有实现它的设计决策。
请问有人能够帮助我找到一种获取Sendbird和Cordova推送通知的方法吗?我认为需要FCM。
请问有人能够帮助我找到一种获取Sendbird和Cordova推送通知的方法吗?我认为需要FCM。
完成后,请按照phone-gap-push中的步骤操作。您只需要以下代码片段即可注册令牌。
const push = PushNotification.init({
android: {
},
browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
},
ios: {
alert: "true",
badge: "true",
sound: "true"
},
windows: {}
});
push.on('registration', (data) => {
// what you get back in your data variable will be two things
// registrationId and registrationType
// Use the returned values to make the platform api call to sendbird
});
getPendingGCMToken(): string;
getPendingAPNSToken(): string;
registerGCMPushTokenForCurrentUser(gcmRegToken: string, callback?: pushSettingCallback): void;
unregisterGCMPushTokenForCurrentUser(gcmRegToken: string, callback?: commonCallback): void;
unregisterGCMPushTokenAllForCurrentUser(callback?: commonCallback): void;
registerAPNSPushTokenForCurrentUser(apnsRegToken: string, callback?: pushSettingCallback): void;
unregisterAPNSPushTokenForCurrentUser(apnsRegToken: string, callback?: commonCallback): void;
unregisterAPNSPushTokenAllForCurrentUser(callback?: commonCallback): void;
unregisterPushTokenAllForCurrentUser(callback?: commonCallback): void; // This removes both All APNS/GCM tokens
然而,我已经以这种方式注册了令牌,但它们在sendbird的仪表板上显示,但我没有收到通知。如果sendbird的支持回复我,我会进行更新。