I would like to send notifications when the user doesn't use/open the application after a time period. For example, if the user does not open the application for 1 minute. A notification will be displayed with the message "We miss you".
Asked
Active
Viewed 189 times
0
-
2Oh my gosh don't support this!!!!111 – Prexx Jul 05 '18 at 14:58
-
Create a cronjob that executes every minute and checks for the running app – John R Jul 05 '18 at 14:59
-
the proper way is to use a server in conjunction. when the user uses the app, you can send something to the server, like the time the app rendered for that user. create a service that checks that whenever u need. if its been that long, send the push. look into onesignal, they do a pretty good job with it – letsCode Jul 05 '18 at 15:03
-
Create a broadcast receiver just like he did in this question: https://stackoverflow.com/q/14385231/6455501 From there start your service on your BroadcastReceiver. – glagarto Jul 05 '18 at 15:07
-
thanks. @dr3k I creat the BroadcastReceiver.I have just a problem. How I can send a notification when the apps is close ? – Michiel Sallaets Jul 08 '18 at 12:49
-
And serviceStart not work when I put it in "onDestroyx". Why ? What can I do ? Thanks – Michiel Sallaets Jul 08 '18 at 14:25
1 Answers
1
Setup a scheduled alarm: https://developer.android.com/training/scheduling/alarms (there is also a example to start the alarm after booting the device)
And check if your app is running or not: https://stackoverflow.com/a/4213851/284308

Prexx
- 2,959
- 5
- 31
- 48