0
- 我設置2個警報爲上午8點第二天使用下面
- 手機(三星Galaxy 6)代碼已經睡着了,在早上8點的確切時間運行
- 報警沒有在上午8時
- 運行在8 :上午50點,我按下主頁按鈕
- 現在,兩個警報都會運行並且通知會顯示在主屏幕上。
我希望通知在早上8點出現聲音。警報在上午8點運行時缺少什麼?報警並在
notificationIntent.putExtra(MyAlarmReceiver.ALARM_ID, alarmID);
notificationIntent.putExtra(MyAlarmReceiver.ALARM_TITLE, notifTitle);
notificationIntent.putExtra(MyAlarmReceiver.ALARM_SUBTITLE, subTitle);
notificationIntent.putExtra(MyAlarmReceiver.NOTIFICATION_TAG, notificationTag);
notificationIntent.putExtra(MyAlarmReceiver.NOTIFICATION_ID, notifId);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
final int sdk = android.os.Build.VERSION.SDK_INT;
if (sdk > android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
alarmManager.setExact(AlarmManager.RTC_WAKEUP, timeInMillis, pendingIntent);
} else {
alarmManager.set(AlarmManager.RTC_WAKEUP, timeInMillis, pendingIntent);
}
謝謝。讓我試着更新。是的,它是6.x – GJain