мое уведомление не работает на API 23.Уведомление не работает на API 23
Мой Notfication работает с API успешным 16 до 22
100 для calstd/calmin является номером по умолчанию.
if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
if(calstd==100||calmin==100){
cancelAlarm();
}
else {
onTimeSet(calstd, calmin);
}
pendingIntent = PendingIntent.getActivity(context, 0, new Intent(context, mainsite.class), 0);
nm1 = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notif = new Notification.Builder(context);
uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
notif.setContentTitle("Remind Me");
notif.setContentText("Vergiss deine Pille nicht :)");
notif.setSmallIcon(R.drawable.ic_launcher);
notif.setSound(uri);
notif.setAutoCancel(true);
notif.setContentIntent(pendingIntent);
nm1.notify(15, notif.build());
...
}
public void setAlarm(Calendar targetCal) {
intent = new Intent(contexta, AlarmReceiver.class);
pendingIntent = PendingIntent.getBroadcast(contexta, RQS_1, intent, 0);
alarmManager = (AlarmManager) contexta.getSystemService(Context.ALARM_SERVICE);
if (Build.VERSION.SDK_INT >= 19)
alarmManager.setExact(AlarmManager.RTC_WAKEUP, targetCal.getTimeInMillis(), pendingIntent);
else if (Build.VERSION.SDK_INT >= 16)
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, targetCal.getTimeInMillis(), 1 * 1000 * 60 * 60 * 24, pendingIntent);
}
Manifest:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<receiver android:process=":remote" android:name=".Alarm"/>
<receiver android:name="com.victoriaremindme.AlarmReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
Ее не работает после закрытия приложения. Я не могу найти проблему.
где корреляция между alarmManager вызовом и BootBroadcastReceiver? ваш вопрос неясен. – F43nd1r
Является ли соотношение между вызовом alarmManager и BootBroadcastReceiver важным для этой проблемы? Я надеялся, что в API23 что-то изменилось, что я не могу найти ... – Lala20
В других API-интерфейсах мое приложение работает нормально. – Lala20