[英]Push notification - Adapter - MFP Migration from 6.3 to 8.0
我有一个带有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/zh/SSHS8R_8。 0.0 / com.ibm.worklight.apiref.doc / rest_runtime / r_restapi_push_message_post.html#Push-Message--POST-
除了在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/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.