bschandramohan
bschandramohan

Reputation: 2006

Notification when app not used for more than certain period

Is there a way to send a notification to the user that app has been downloaded but a certain task from the app is not yet complete even after certain period - say a month. One way is a background service which should come alive every month in this case, check the app state (in sharedprefs) and then send a notification. Is there some other easier way in Android without writing custom service.

Upvotes: 2

Views: 87

Answers (2)

kabuko
kabuko

Reputation: 36302

In order to wake up your app after some amount of time (in your example a month) you're going to have to set an alarm. You can use AlarmManager for that. If all you're going to do is check SharedPreferences, you can do that in a broadcast receiver. You can send your notification there.

Upvotes: 1

LuxuryMode
LuxuryMode

Reputation: 33741

Here's how I would do it. Schedule an alarm using the AlarmManager to go off a month from today. That alarm can trigger some code inside of a Receiver or otherwise to check whether the said event has occured. If it hasn't, you can then show a Dialog or whatever.

Upvotes: 2

Related Questions