1
我創建了一個通過AlarmManager啓動的簡單狀態通知。一切工作正常(通知的內容,標題,點擊時啓動的活動等)。不幸的是,當通知被調用(即AlarmManager關閉)時,會啓動並顯示一個空的活動。該活動只是在狀態欄中有我的應用程序名稱和圖標。實際活動本身是空白的。同樣,當通知關閉並且第一次出現在狀態欄中時,會發生這種情況。當我再次點擊通知時,它會轉到正確的待處理活動。這裏是我的代碼:NotificationManager啓動空活動
下面是設置AlarmManager打電話通知代碼:
//Use AlarmManager to trigger the notification/alarm.
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
//PendingIntent to launch activity when the alarm triggers.
Intent intent = new Intent("com.YouForgotWhat.FlightGear.DisplayNotification");
PendingIntent displayIntent = PendingIntent.getActivity(getBaseContext(), 0, intent, 0);
//Set an alarm to go off at 30 minutes before fuel runs out.
alarmManager.set(AlarmManager.RTC_WAKEUP, endTimeInMillis - (30*60*1000), displayIntent);
,這裏是通知本身(這是在其他活動)的實際代碼:
公共類DisplayNotification擴展SherlockActivity {0}私人上下文context = this;
我該如何解決這個問題?謝謝!
工程就像一個魅力,謝謝! – NewGradDev