首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Sendbird未收到推送通知

Sendbird未收到推送通知
EN

Stack Overflow用户
提问于 2018-09-11 23:55:46
回答 1查看 746关注 0票数 1

我在OnMessageReceived处理程序上实现Xamarin.iOS应用程序上的Sendbird,并且已经收到消息。

但是我无法接收推送通知,GetPendingPushToken()总是返回null,所以在RegisterAPNSPushTokenForCurrentUser()方法中,我只传递一个带有设备令牌的字符串。并在SendBird仪表板上注册用户令牌,如下所示:

"05d0c16a 52328ef2 973b29bb91556ed6 59dcb340 321dc3e6 b0842c20 6e5190d2“。

我注意到,在registerDevicePushToken() SDK中,我无法访问iOS SDK中可用的方法.NET,在示例中,该方法是在didRegisterForRemoteNotificationsWithDeviceToken()方法中实现的。

API是在SendBird仪表板上正确设置的,我已经从另一个API接收到设备上的推送通知。

EN

回答 1

Stack Overflow用户

发布于 2018-09-14 02:03:12

SendBird .NET SDK提供了两种push注册方法,因为它可以同时用于安卓和iOS。

安卓: RegisterFCMPushTokenForCurrentUser

iOS: RegisterAPNSPushTokenForCurrentUser

代码语言:javascript
复制
SendBirdClient.Connect(userId, (User user, SendBirdException e) => {
    if (e != null) {
        // Error.
        return;
    }

    if (SendBirdClient.GetPendingPushToken() == null) return;

    // For Android
    SendBirdClient.RegisterFCMPushTokenForCurrentUser(SendBirdClient.GetPendingPushToken(), (SendBirdClient.PushTokenRegistrationStatus status, SendBirdException e1) => {
        if (e1 != null) {
            // Error.
            return;
        }

    if (status == SendBirdClient.PushTokenRegistrationStatus.PENDING) {
            // Try registration after connection is established.
        }    

    });

    // For iOS
    SendBirdClient.RegisterAPNSPushTokenForCurrentUser(SendBirdClient.GetPendingPushToken(), (SendBirdClient.PushTokenRegistrationStatus status, SendBirdException e1) => {
        if (e1 != null) {
            // Error.
            return;
        }

    if (status == SendBirdClient.PushTokenRegistrationStatus.PENDING) {
            // Try registration after connection is established.
        }

    });
});
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52285618

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档