这是我的应用程序。 我已触发警报,但我如何设置特定日期的警报。请告诉我。 公共类警报 {
private Event event;
public void myAlarm(String name,String bankName,String AccNo)
{
try
{
EventList eventList = (EventList)PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.WRITE_ONLY);
event = eventList.createEvent();
event.addString(event.SUMMARY, PIMItem.ATTR_NONE, name+"\n"+AccNo);
event.addString(event.LOCATION, PIMItem.ATTR_NONE, bankName);
event.addInt(event.ALARM, PIMItem.ATTR_NONE, 0);
event.addDate(event.START, PIMItem.ATTR_NONE,System.currentTimeMillis()+120000);
event.addDate(event.END, PIMItem.ATTR_NONE, System.currentTimeMillis()+360000);
event.commit();
}//end of try block
catch(Exception e){}
}//end of method myAlarm
}//end of main class Alarm
答案 0 :(得分:0)
试试这个:
RepeatRule recurring = new RepeatRule();
recurring.setInt(RepeatRule.FREQUENCY, RepeatRule.YEARLY);
recurring.setInt(RepeatRule.MONTH_IN_YEAR, RepeatRule.MARCH);
recurring.setInt(RepeatRule.DAY_IN_MONTH, 11);
recurring.setInt(RepearRule.COUNT, 1);
event.setRepeat(recurring);
这将在3月11日发射警报一次。 这是你需要的吗?