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
Related
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)
I want to create an application which have 2 modes: non-logged-in and logged-in (having username).
I want to send push notifications to devices in both modes. The non-logged-in devices should receive notifications such as general announcements, new events, etc. The logged-in mode devices will also receive same notifications and few more.
Now what I want to do is to subscribe the device to receive notifications for non-logged-in mode then once the user logs in to his account from that device I want to unsubscribe the previous non-logged-in notifications.
I've read the answer to this question : Worklight: Push notification without User ID I think that I can play with onUserSubscribe callback when registering the user and unsubscribe the userId of the persistent cookie.
Is this a good idea ? Is there another suggestion ?
My thinking is that you could register an app to 2 event sources.
The first event source will handle the general notifications that an app should receive, whether a user is logged-in or not.
The second event source will handle the notifications for logged-in users.
When the app launches, subscribe to the first event source.
When the user decides to log-in, subscribe to the second event.
You should allow the user to unsubscribe from both if s/he so chooses, as well.
Additional information:
IBM Worklight 6.1 Information Center: search for "push notifications"
Push Notifications training module
So what you're trying to achieve is push notifications broadcast (send to all users). This is something that you'll be able to do with upcoming Worklight 6.2 release. You will not have to subscribe users according to username, but will be able to specify tags during subscription. And after that you'll be able to send push notifications according to this tags.
I am writing back end for mobile app, we are sending pushes (something like one user add
another to buddies) he should accept it or decline via push notification(it is required), server got some feedback from notification, and do something.
I am familiar with two techniques about pushes, first I push directly on device using token, second is abstraction when user subscribes for channel and I send push notification on this channel. Id in my application is email, and I suggest to update device token in the database each time user login, and send push on it, but how should I identify device OS ?(IOS/Android)
1) How to scale it, if user have multiple devices, and when user will logout, and login from other device ?
May be there is common solutions for this problem.
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.
Basically my understanding of push notifications is that they can change tiles and display a message to the user when the app is closed.
What I would like to know is if its the right way to go as the main control method in a turn based mobile game? For example the specific situation im wondering about is if the user has the application open and they make their move which gets sent off to my service could the application then sit and listen for the push notification reply and update the ui/continue with the users turn? obviously if the user moved away it should still do the sort of notification mentioned first that updates tiles/ displays a message but if the apps open it should just use a value in the notification and the user should never know it was a notification, just see the other players move and continue with theirs?
thank you
John Harris
Toast notifications are ignored if your app is already running, unless you register for the ShellToastNotificationReceived event. Your app can then decide how it wants to respond to the toast notification.
As you can see from this quote, if the app is open, it can choose to recieve toast notifications and decide how to handle them.
When the app is running you can also receive raw notifications, which can contain more data than toast notifications.