【问题标题】:Push notification - Adapter - MFP Migration from 6.3 to 8.0推送通知 - 适配器 - MFP 从 6.3 迁移到 8.0
【发布时间】:2017-08-19 12:23:37
【问题描述】:

我有一个带有 MFP 6.3 版本的示例推送通知应用程序和适配器(从 http://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/6.3/notifications/push-notifications-hybrid-applications/ 下载)。

我已将移动应用程序迁移到 MFP 8.0。在适配器中,它们具有相同的功能(过程),例如, WL.Server.createEventSource、WL.Server.notifyAllDevices、WL.Server.createDefaultNotification、WL.Server.getUserNotificationSubscription

WL.Server.createEventSource({
    name: 'PushEventSource',
    onDeviceSubscribe: 'deviceSubscribeFunc',
    onDeviceUnsubscribe: 'deviceUnsubscribeFunc',
    securityTest:'PushApplication-strong-mobile-securityTest'
});

function submitNotification(userId, notificationText){
    var userSubscription = WL.Server.getUserNotificationSubscription('PushAdapter.PushEventSource', userId);

    if (userSubscription==null){
        return { result: "No subscription found for user :: " + userId };
    }

    var badgeDigit = 1;

    var notification = WL.Server.createDefaultNotification(notificationText, badgeDigit, {custom:"data"});

    WL.Logger.debug("submitNotification >> userId :: " + userId + ", text :: " + notificationText);

    WL.Server.notifyAllDevices(userSubscription, notification);

    return { 
        result: "Notification sent to user :: " + userId 
    };
}

此功能是否适用于 MFP 8.0?

下面提到的网址只是正确的替换。对? 1.http://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/sending-notifications/#sending-notifications 2.https://www.ibm.com/support/knowledgecenter/en/SSHS8R_8.0.0/com.ibm.worklight.apiref.doc/rest_runtime/r_restapi_push_message_post.html#Push-Message--POST-

【问题讨论】:

    标签: cordova push-notification ibm-mobilefirst mobilefirst-adapters mobilefirst-cli


    【解决方案1】:

    除了 v6.3 到 v8.0 之间的一些功能增强之外,推送通知还经历了重大的架构变化。

    首先,在 v8.0 中,没有现成的服务器端 SDK 可用于从适配器内发送推送通知。但是,这并不意味着这是不可能的 - 您可以直接从适配器中使用 REST API。 参考:你的q中的链接2。多于。您的安装也可以使用 Swagger 文档。

    其次,在 v8.0 中删除了基于事件源的通知,以支持基于标记的通知。请按照迁移路径上的以下链接进行操作: http://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/upgrading/migrating-push-notifications/

    【讨论】:

    • 嗨 Srinu,我明白了。感谢您的宝贵帮助
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    • 2021-09-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多