Push Notification had been executed and worked perfectly in my
application. (I made use of worklight push notification module IBM
LINK)
There was a scenario which i experienced during the
notification received in the application android device.
The push notification is received perfectly in all the situtaion except when i am in the Login Screen(When i am in the login screen of the application the push notification is not received in my application).
Question :
Why push notification is not received in the application ?
What is the client side (Device side) architecture/execution flow , by which i can
understand when is the PushNotification Receiver (Broad Cast
Receiver) in device is ready to receive the notification and when it
can't receive notifications ?
This is the expected behavior.
You've implemented event source-based pus notifications. In this type of push notifications you must first login in order to receive notification. This is why while you're at the login screen, you will not receive the notification.
If you are using either Worklight 6.2 or MobileFirst Platform 6.3, you can use tag or broadcast-based notifications which do not require a login.
You can read more about these at the IBM MobileFirst Platform developer center.
Here is a rundown of possible scenarios:
Application is closed - notification arrives to device - by opening the application / tapping the notification in the notification bar, you will get a login screen. After you login you will actually see the payload (in the way you choose to, that's purely applicative). You will not see the actual payload, because you don't want user B for example to see the payload of user A.
Application is opened - you are logged in, but the app is in the background - notification arrives to the device - by tapping the notification or bringing the application to the foreground, because you are already logged in, you'll see the payload
Application is opened - you are NOT logged in - notification arrives to the device - you will not be able to see the payload, because you are not logged in.
Application is opened - you are logged in, and the app is in the foreground - notification arrives to the device - you will immediately see the payload (per your applicative code)
Related
I use Appcelerator Titanium and I have module ti.goosh for push notification. How can I find out about notification delivery? In 'callback' I can find out about opening the notification, but I want to also know that the notification is in the device tray (for example using console.log).
I depends on what kind of message you are sending. A FCM data message is handled by the module with the NotificationCompat.Builder but if you are sending a normal FCM notification message the system is creating the notification and displaying it. You will only know if the notification was clicked by the user (like you already do) or if it arrived while the app was in foreground.
I do use onesignal API to send/ receive push notifications.
Is there a way to send/receive web notification only when user is online: if offline, then push is discarded (online = browser opened)
ex: user1 has his browser closed. A notification is sent.
Normally, he will get it next time he opens his browser.
Is there a way a discard that notification ?
(sent when he was offline)
Yes, you can achieve this with the TIME TO LIVE option, by default is 3 days but you can set to 0 and the message will be discarded if the user is offline.
Source
I am using mobilefirst push notification service in my application. I am using rest api to send the message to GCM.
GCM receives and send it back to the mobile device too but in the device I am able to see the push message in the log, but not in alert which is the event source I have registered in my client device.
You have received a notification intended for Push.ALL tag. This is a broadcast notification and will not appear within the callback you registered with your Eventsource subscription.
You should use the onMessage callback API, as described in KnowledgeCenter and GettingStarted.
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.
We are currently using WL build 6.2.0.01-20141216-0427
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.
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.
Launched sample push notifications app (which uses event source-based notifications) on device
Logged-in > Subscribed
Quit application
I then sent a notification by invoking the adapter in the Studio
The notification arrived and displayed in the notification bar
Tapping the notification launched application
Logged-in
The notification alerts were then displayed.
I then moved the application to the background.
Sent another notification, which was displayed in the notification bar upon arrival
Tapping this second notification brought the application to the background, displaying the alerts
I then kept the application in the background.
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.
Can you interrogate the Apple (APNS), Google (GCM) or Windows Phone push notification servers after the fact to find if a notification was delivered?
I know that when a server initially sends the push notification there is a response to say whether the message was processed (but this doesn't mean delivered) or rejected by the notification server. But is there any way to subsequently find out via Android, iOS or Windows Phone 8 if the message was delivered?
Ideally I'd like to achieve this just by interrogating the vendor's push notification server, worst case I'm assuming I'd have to put something in my app to register that a given notification arrived and somehow transmit this success status back to my server.
APNS, GCM and MPNs don't offer this functionality.
You'll have to support it yourself, by sending an acknowledgment from the app to your server whenever a notification reaches your app.
For GCM you can view statistics of deliveries, but nothing for individual deliveries :
Viewing Statistics
To view statistics and any error messages for your GCM applications:
Go to the Developer Console.
Login with your developer account.
You will see a page that has a list of all of your apps.
Click on the "statistics" link next to the app for which you want to view GCM
stats.
Now you are on the statistics page.
Go to the drop-down menu and select the GCM metric you want to view.
Note: Stats on the Google API Console are not enabled for GCM. You
must use the Developer Console.