Andrei Catinean
Andrei Catinean

Reputation: 883

Show alarm/notification at a particular date

Briefly, I have a database table of events with start date and end date as columns (expressed as unix time stamps - milliseconds). What I want is to fire up a notification or an alarm at every end date of my events. How should I do this?

I thought it might work this : create a service that queries the database every 1 minute and when the current calendar instance equals the end date from my table show up a notification. But I don't think this is the right approach.

What is your opinion , how should I do this?

Upvotes: 2

Views: 656

Answers (1)

Sunit Kumar Gupta
Sunit Kumar Gupta

Reputation: 1213

use

pendingIntent = PendingIntent.getActivity(this, alarmTime_id, myIntent, PendingIntent.FLAG_CANCEL_CURRENT);
                         alarmManager.set(AlarmManager.RTC_WAKEUP, alarmTime, pendingIntent);

use unique alarmTime_id each time.

Upvotes: 1

Related Questions