for example i want to have an alarm that will fire every sunday at noon.... how would i do this?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How can I create this custom Bottom Navigation on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
finally this right solution if set as (sun,tus ,fri) you must create three alarm for these three day the following code set alarm every sunday and send dayOfWeek=1;
Use the AlarmManager class:
http://developer.android.com/reference/android/app/AlarmManager.html
Use
public void set (int type, long triggerAtTime, PendingIntent operation)
to set the time to fire it.Use
void setRepeating(int type, long triggerAtTime, long interval, PendingIntent operation)
to schedule a repeating alarm.Here's a full example. I don't really remember all the Calendar methods, so I'm sure that part can be streamlined, but this is a start and you can optimize it later: