I have custom Alarm Clock Application. When the alarm triggering, my Activity starts. That works on Android 9, but doesn’t work on Android 10 from background [Restrictions on starting activities from the background][1]. Google suggests launching notifications instead of activity, but I don’t quite understand how to display the alarm triggering using notifications. Are there any other solutions to display the alarm triggering?
final PendingIntent alarmIntent = getAlarmActivityIntent();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
PendingIntent showIntent = getShowIntent();
AlarmManager.AlarmClockInfo info = new AlarmManager.AlarmClockInfo(ringAt, showIntent);
if (am != null)
am.setAlarmClock(info, alarmIntent);```
[1]: https://developer.android.com/guide/components/activities/background-starts#display-notification