Android Background Service which check current Date

Viewed 53

I programmed a simple calendar app where you can add Events to specific Dates.

When I close the app it still should check once a day which Date is it and if an Event is on this Date. If there is an Event a push notification shall appear.

How could I do that? I save the Date with an event within the sharedPrefrences.

Can someone help?

1 Answers

If it doesn't matter when during the day the notification is sent, then @AliasCartellano comment is correct. However, if you want to send the notification at a specific time during the day (i.e. not at 23:59 when the user is sleeping), then you should use AlarmManager. Specifically, look at setAlarmClock(). This is its intended usage.

Related