简体   繁体   English

IBM Worklight:推送通知行为

[英]IBM Worklight: Push Notification Behaviour

I have some questions related to Push Notification in Worklight: 我有一些与Worklight中的推送通知有关的问题:

  1. If push notification is received when the app is in background or closed, it will be displayed in notification bars. 如果在应用程序处于后台或关闭状态时收到推送通知,它将显示在通知栏中。 When the notification message is clicked, it will be directed to the homepage of the app. 单击通知消息后,它将被定向到应用程序的主页。 May I know if it is possible to switch to other pages instead of homepage? 我可以知道是否可以切换到其他页面而不是首页吗?

  2. When the app is closed and the notification message arrives, I launch the app by clicking the app icon instead of message in notification bar, it seems to me I cannot get back the notification message in the app. 当应用程序关闭并且通知消息到达时,我通过单击应用程序图标而不是通知栏中的消息来启动应用程序,在我看来我无法在应用程序中取回通知消息。 (There is no problem when the app is running in background) (当应用程序在后台运行时没有问题)
    Steps: 脚步:
    a) Subscribe to an event source inside the app a)订阅应用内的事件源
    b) Close the app b)关闭应用程序
    c) Submit notification ("Hello") to the device c)向设备提交通知(“ Hello”)
    d) In the app, notification message ("Hello") is displayed in the status bar. d)在应用程序中,状态栏中显示通知消息(“ Hello”)。 Slide down the status bar. 向下滑动状态栏。 The message is displayed in Notification bar. 该消息显示在通知栏中。
    e) Do not click the notification bar to enter to the app. e)不要单击通知栏以进入应用程序。 Instead, click the app icon (which is the normal way to get into the app). 而是单击应用程序图标(这是进入应用程序的常规方法)。
    Result: It seems that pushNotificationReceived is not invoked and thus I cannot get back the notification inside the app. 结果:似乎没有调用pushNotificationReceived,因此我无法在应用程序内取回通知。
    Thanks a lot!! 非常感谢!!

Details: 细节:
Worklight 5.0.6 工作灯5.0.6
Android version 4.1.1 (Samsung Galaxy S3) Android版本4.1.1(三星Galaxy S3)

Regarding the first question: Considering Worklight a single-page application, you cannot direct to different HTML pages as you will lose the context to Worklight. 关于第一个问题:考虑到Worklight是单页面应用程序,您将无法定向到其他HTML页面,因为您将失去上下文到Worklight。

That said, if you are using jQuery's pages and fragments approach, MAYBE what you could do is pass a certain value in the payload and in pushNotificationReceived (I am basing this on the push notifications sample app ), you could do some JavaScript magic to load specific content based on the payload... 就是说,如果您使用的是jQuery的页面和片段方法,则可能要做的是在有效负载和pushNotificationReceived传递某个值(我将其基于推送通知示例应用程序 ),您可以执行一些JavaScript魔术来加载基于有效负载的特定内容...

Regarding the second question: please edit your post with more detailed reproduction steps. 关于第二个问题:请使用更详细的复制步骤编辑您的帖子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM