How do I make my server trigger push notification on new record inserted?
I managed to implement push notification in my app.
Now As the title says how do you make the server trigger a push notification on new record inserted ?
All tutorials I see explain how to set up the push notification, but I need to find a good way to accomplish that.
I thought about creating a script to run on a cron job, and check database and fields.
What is the best way to achieve that? any suggestion?
You don't have a billion options you know:
- push the notification as you inserting the data.
- Write a script to run a cron job.
Option #1 is better in my opinion. but when you have to many apps doing the INSERT and you have not designed your apps to implement the push notification from the beginning than you left with option #2
you need to track push notification id of device you need to push notification to. if User A need to receive a push notification . you need to store devices token on you database under User A record. and when user A records inserted you need to do push on device token according to user token. sorry just typed in rush i ll edit it soon
You could use the on recive function. so the triger will be after reciving the sms and inserting.