Reputation: 157
I'm working on an ionic project.
If users don't open the application for a long time after downloading my app, I'd like to send them local notification. For example, I will send a notification if it does not open for 3 days. But I couldn't figure out how.
Can you help me?
Upvotes: 0
Views: 323
Reputation: 565
You can use the following to send notifications from server:
Create one table in your database to track user activities.
Add columns as userId, lastActivity to store the time of the user's activity.
Update the lastActivity column whenever the user opens the app.
Write one scheduler which will run at a specific time every day.
In the scheduler write a logic to get data from UserActivity table and compare the time stored in the table with your current time.
If the time difference is greater than 3 days then send a notification to that user.
For local notifications here is a way:
Whenever user open's the app schedule the local notification of after 3 days from current date. ( Make sure to remove previously schedule notification before adding new one. )
In this case if user open the app notification will reschedule automatically else notification will fire based on last schedule of it.
Upvotes: 2
Reputation: 706
You can create a system in which you track user like ,
if user's opens your App then you must update true value for that user with time in your database and now you can compare current time with user's time value and if its more then 3 days you must send notification to that user.
Upvotes: 1