0
我想用AlarmManager調用BroadcastReciever:AlarmManagerIntent不會被調用
Context ctx=getApplicationContext();
Intent StartIntent = new Intent(ctx, tartReceiver.class);
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC, StartTime.toMillis(false), PendingIntent.getActivity(ctx, 6,
StartIntent, PendingIntent.FLAG_CANCEL_CURRENT));
接收機處於這樣的清單中聲明:
<receiver android:process=":remote" android:name=".StartReceiver" android:exported="true"/>
但什麼都沒發生。如果我使用ctx.sendBroadcast(StartIntent),那麼這個intend會被調用,所以它應該是正確的,或者不是? 我也檢查了StartTime,它應該沒問題,我也試過0(這應該導致意圖根據文檔立即調用)。
必須改變才能使其工作?