Re: [問題] 請問該如何建置每週重復的AlarmManager
Mia謝謝您的解答,還有一個問題想請教您一下
我的鬧鐘觸發的method如下:
private void fireTime(long firetime) {
AlarmAnager alarm = (AlarmManager) getSystemService(ALARM_SERVICE);
Intent i = new Intent();
i.setAction("go");
PendingIntent sender = PendingIntent.getBroadcast(this, 0 , intent, 0);
alram.setRepeating(AlarmManager.RTC_WAKEUP, firetime,
5*1000, sender);
}
MyReceiver的onReceive如下:
Intent i = new Intent();
if(intent.getAction().equals("go")) {
Toast.makeText(context, "gogogo", Toast.LENGTH_LONG).show();
}
Menifest也註冊了
<receiver android name = ".MyReciever">
<intent - filter>
<action android:name = "go">
</intent - filter>
</receiver>
但是run起來MyReceiver卻都沒收到廣播,不會執行Toast
我有哪個地方漏掉嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.132.134.150
→
07/19 19:03, , 1F
07/19 19:03, 1F
→
07/19 19:03, , 2F
07/19 19:03, 2F
→
07/19 19:03, , 3F
07/19 19:03, 3F
推
07/19 22:32, , 4F
07/19 22:32, 4F
→
07/19 22:33, , 5F
07/19 22:33, 5F
→
07/19 22:34, , 6F
07/19 22:34, 6F
→
07/19 23:03, , 7F
07/19 23:03, 7F
→
07/20 00:06, , 8F
07/20 00:06, 8F
→
07/20 00:07, , 9F
07/20 00:07, 9F
→
07/20 00:08, , 10F
07/20 00:08, 10F
→
07/20 00:09, , 11F
07/20 00:09, 11F
→
07/20 00:09, , 12F
07/20 00:09, 12F
→
07/20 00:10, , 13F
07/20 00:10, 13F
討論串 (同標題文章)
完整討論串 (本文為第 3 之 4 篇):