【发布时间】:2014-09-25 21:10:25
【问题描述】:
我想在每天上午 9:00 检查一些网址。但是我该怎么做呢?我确实检查了一些关于 AlarmManager 和 IntentService 的主题和文章,但我无法为我的应用程序聚在一起,是否有任何示例代码或其他内容?谢谢..
【问题讨论】:
-
AlarmManager 有什么问题?
-
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(context, Zamanlayici.class); intent.putExtra(ONE_TIME, Boolean.FALSE); PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, 0); //5秒后 am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 1000 * 10, pi);就像这段代码,我可以在这个特定的时间之间做,但我不能在这个特定的时间里做
-
因此,创建一个
Calendar对象,作为您第一个事件的特定时间,并使用INTERVAL_DAY的时间段使其每24 小时重复一次。 -
你的日历对象是什么?