我正在做一個鬧鐘應用程序,我正在使用一種方法在特定的時間開始一個活動, ,我在我的應用程序中有一個選項,名爲enable \ disable,我不想讓鬧鐘打開活動(當我檢查禁用框時,播放聲音並獲得我選擇的圖像! 所以我正在尋找一種方法來在開始之前關閉活動&不要在屏幕上進行任何顯示以顯示活動正在開始和結束! 我使用在特定的時間如何在開始之前強制關閉活動?
Intent myIntent = new Intent(SharedPrefs.this,MainPhoto.class);
pendingIntent = PendingIntent.getActivity(MainPhoto.this, 0, myIntent, 0);
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis()+10000);
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
在任何幫助打開特定活動這種方法嗎?
您可能希望以更好的方式來處理你的報警:http://blog.blundell-apps.com/notification-for-a-user-chosen-time/ – Blundell