android中的定时任务AlarmManager

  1. private void requestUpdateFeatureBook() {  

  2.     AlarmManager am = (AlarmManager)getContext().getSystemService(Context.ALARM_SERVICE);  

  3.   

  4.     PendingIntent sender = PendingIntent.getBroadcast(getContext(), 0,new Intent(Config.UPDATE_FEATUREBOOK), 0);  

  5.     am.cancel(sender);  

  6.     am.setRepeating(AlarmManager.RTC, System.currentTimeMillis()/*Config.FEATUREBOOK_UPDATE_TIME*/,Config.FEATUREBOOK_UPDATE_TIME, sender);