How can I send notification in same time everyday - OneSignal - android

How can I send a push notification to my android phone with OneSignal
example I want to send automatic message at 6.00am everyday.
How can I implement it?

You can do it by running cron job on server side.
It's so simple : just set cron to start everyday on 6 am and run the command to send push notif message to all fcm_tokens which are registered already.
I suggest you to queue the messages for getting better result.

Related

Sending push notifications to different users at device time with FCM

I want to send a Push notification to different users at different time. The time will be devise time not server time.
For example -
I want to send a push notification to 'Ajay' at 8AM of device time - 'Good Morning Ajay'
I want to send a push notification to 'Gargee' at 2PM of device time - 'Have a wonderful day'
How do I receive the device time before sending the push notification?
You can't schedule notification on mobile side.
Notification messages don't execute your application code when your app is in the background. All messages sent from the Firebase console are Notification messages. So you can't currently use the Firebase console for what you are describing. So, you can send Data messages from your app server which can trigger background execution of code. You can manage the notification scheduling on your app server Using cronjob.
Otherwise, You can write cloud function for notification scheduling...
You can take the support of local notification here. You can either fire local notification or you can use DispatchQueue.main.asyncAfter to make an API call for saving the device time and also fire the push notification accordingly.

Android: Have PushNotifications an income-timestamp?

we are using the Gcm Push Notification Server from our externel Java Project to send push notifications to an Android Phone.
On this phone there is an app running that reacts on this notification. The app needs to know when the push notification arrived at the phone (in order to calculate a 120sec timer beginning at this point of time).
Is there a possibility in the andorid app to find out when the push notification arrived...some kind of creation/imcome/recieved timestamp?
Thx
Try System.currentTimeMillis() in your GcmListenerService's onMessageReceived() method.

Mass push notification sending in some intervals

I am trying to figure out how Facebook / Twitter sends push notifications like "You have 20 new followers"I don't know how to call it but i want to learn the underlying algorithm of this in Android. Please help, Thanks !
On Android you can execute your code before actually showing a push notification. They could simply send a push notification to all devices with an identifier, then the app can make a request to the server and get the needed information in order to show the push notification.
They can also send one push notification per device, as they can associate the push notification key with the user login, and the server would fire a push notification every time there is an event that demands a push notification.
But there are also other ways of doing this, for example, they can, for example run locally in background and create a local notification when the app decides it is necessary.

Is possible to receive push notification in First in First out order from GCM?

I have developed an app using GCM for push notification.My app using for stacking purpose so I have to receive notification like in First in First out order.But now am not getting notification from GCM in order.How to manage to receive notification in order and is possible to manage GCM server from our end.
No it's not possible in GCM server. But another way is you can Hack this Notification in your Server triggered by GCM and Run a cron at particular order.
no you cannot get the notification in first in first out order .they are randomly generated by the server.you can do this in your server connected with GCM and put them in serial order
gcm document already mention this
http://developer.android.com/google/gcm/adv.html
Note that the order of delivery is not guaranteed.
GCM order of message is not guaranteed. For this you can achieve another way.
Ask to server guys to create API(Webserver) for message, The message is same as they were earlier sending through the GCM.
After that you have to create Calender scheduler (Like Every 5 min) and then call this web-service and show notification.

Setting scheduled push notification on GCM Server

Is it possible to set up a Scheduled Push notification from the GCM server.
Example:
As I click a button i send an api call to the GCM server to send me a push after 30min.
Is that possible?
If yes, please guide me.
Thanks in advance.
No, it's not possible. GCM server attempts to deliver the messages you send to it immediately.
If you want to schedule a message for delivery at a given time, schedule it in your server. i.e. make your server send it to GCM server after 30 minutes.

Categories

Resources