Reputation: 1695
In my app i'm using RPush Gem to implement push notifications. Right now admin can send a custom message as notification.
What I want is to send an automatic notification if the user hasn't logged in for 2 days. I can check this in my database where I'm keeping a record like last_logged. But i want to know how to check this automatically and run in background.
Upvotes: 2
Views: 456
Reputation: 5462
Hard to give better suggestions without more detail, but if you're on a platform like Heroku, you can do scheduled cron jobs using their scheduler add on. So the idea is:
1) Implement a rake task that checks whether a user hasn't logged in for 2 days, then send an email to yourself (or whomever) 2) Schedule this rake task via Heroku Scheduler add on
If you're not using Heroku, I'm sure there are equally compatible services you can try to run a cron job.
Upvotes: 1