I need to set an alarm at perticular time that repeats given number of time only.
There is
void set(int type, long triggerAtTime, PendingIntent operation)
It gets called for once. I can check preference value and can set it again for my requirement.
I can use this also. At every alarm trigger can check preference value and if limit achieved. Can cancel alarm then.
void setRepeating(int type, long triggerAtTime, long interval, PendingIntent operation)
I want to avoid this preference stuff within this operation.
Are there other ways of doing this ?
Pass the number of times you want to repeat the alarm as a int value bundled with the intent.
At every trigger decrement the value by 1.
If it reaches 0 cancel it.
No Preferences required.