0
votes

I have a Worklight app doing push notifications. Sending the push causes the notification to appear in the notification bar on both Android and iOS as expected. If the push is received while the app is running, it calls the message handler function as it is supposed to.

The issue I'm having is that if you launch the app by tapping on the notification on iOS, the message handler never gets called if another push is sent while the app is running. I have to exit the app and kill it completely, then relaunch the app from the launcher. Then if the push is received while the app is running, it will call the message handler.

This only occurs on iOS. The app will respond to a received message on Android while the app is running, even if the app has been launched by tapping on the notification.

EDIT:

I did struggle to verbalize the scenario, couldn't find the right words that made sense, but the steps you have done Idan are largely correct for what I'm trying to do. We are doing tag based notifications, so that is different that what you have done. We are also using PersistentCookieAuthentication as they wanted push notifications to be sent without the user having to explicitly logging in.

  1. We are currently using WL build 6.2.0.01-20141216-0427
  2. We've tried it on a couple of different models, an iPhone 4s running 8.0.2, and an iPhone 5 running 8.1.2.
1
Can you edit the middle paragraph with better wording? Something there does not sound logical. You start your explanation in that paragraph when the app is closed, but then all of a sudden you say it's not working when the app is opened. Clarify.Idan Adar
Which devices was this tested on?Nathan H
Digital Wolf, Tag-based notifications do not require a login at all, only event source-based notification require that. Both Broadcast and Tag notification simply require subscribing the device (not a specific user) to a tag, and then the notification will be sent to that device. There is no "multi-user subscription" in broadcast/tag, for that you use event source. You will need to supply actual code relevant to sending and receiving the notification in order to further debug this.Idan Adar
Perhaps if you could create a sample application (not your client's application) that demonstrates the issue, it will be easier to debug; please mention my nickname @IdanAdar so that I'll get a notification when you reply here.Idan Adar
@DigitalWolf, see my updated answer.Idan Adar

1 Answers

0
votes

Edit based on the edited question:

Tag-based notifications do not require any login, as it is the device that is to be subscribed to any tags that you define in application-descriptor.xml; it is not login-based, so any type of login that you are doing it irrelevant. The push will be sent to any device (app...) that was subscribed to your tag using the subscribeTag API.

I did another test in iOS using a broadcast-based notification (it's basically like tag-based notifications). I kept the app in the background and sent a notification. Tapping on the incoming notification in the notification bar brought the app to the foreground, which then displayed the alerts of the incoming notification.

You can try it with this application: https://www.dropbox.com/s/l2yk2pbvykrzfoh/broadcastNotificationsTest.zip?dl=0 Make sure to place your own .p12 certificate and pushSender password.


I've been trying to understand your scenario... I suspect you've left out something or need to better word the problem description.

Here's what I've tried using MobileFirst Platform 6.3 (no drastic push changes in iOS between 6.2 and 6.3) and iPhone 6 running iOS 8.1.2.

  1. Launched sample push notifications app (which uses event source-based notifications) on device
  2. Logged-in > Subscribed
  3. Quit application

I then sent a notification by invoking the adapter in the Studio

  1. The notification arrived and displayed in the notification bar
  2. Tapping the notification launched application
  3. Logged-in

The notification alerts were then displayed.
I then moved the application to the background.

  1. Sent another notification, which was displayed in the notification bar upon arrival
  2. Tapping this second notification brought the application to the background, displaying the alerts

I then kept the application in the background.

  1. Sent a third notification

In this case, because the application is in the foreground, the notification did not display in the notification bar -- as expected -- and instead the alerts were displayed right away.

If your scenario is different than the above, such as: you're not even using event source-based notifications but rather broadcast- or tag-based notifications, or your application flow differs, etc then please edit the question with a more precise description.

When you edit the question, also mention the following:

  • Worklight version and build number
  • Device model
  • Used iOS version

I am aware of one possible issue (APAR #PI31988) that is currently under investigation, where the underlying native code dispatches the message before the JavaScript framework is ready to handle it, thus no message is displayed. This was found to happen in slower devices such as iPhone 4.