0
- を実行しなかった私は
- 電話(サムスンギャラクシー6)以下のコードを使用して、次の日の午前8時のために2つのアラームを設定
- アラームが8時午前8時
- で実行されなかった午前8時眠っていました:50 AM、ホームボタンを押しました
- アラームが実行され、ホーム画面に通知が表示されるようになりました。
音が午前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