Я создаю уведомления с помощью AlarmService. При нажатии на созданное уведомление открывается приложение.
Закройте приложение с помощью кнопки «Назад» и не удаляйте его из списка последних приложений. теперь я открываю приложение с помощью значка приложения. В приложениях отображается история последних приложений.
Я тоже использую это решение, но оно у меня не работает. android:launchMode="singleTop"
activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:enableOnBackInvokedCallback="true"
android:windowSoftInputMode="adjustResize">

Для закрытия приложения кнопкой «Назад»
PopScope(
canPop:canPopNow,
onPopInvokedWithResult: (didPop, result) {
if (0 < controller.currentIndex.value) {
canPopNow=false;
controller.changePage(0);
} else {
DateTime now = DateTime.now();
if (_lastPressedAt == null || now.difference(_lastPressedAt!) > Duration(seconds: 2)) {
_lastPressedAt = now;
VxToast.show(context, msg: "Please click BACK again to exit",textColor: Colors.black,bgColor: Colors.grey.shade300.withAlpha(128),showTime: 800);
// print("Press again to exit $_lastPressedAt -- $now");
// print("Press again to exit ${now.difference(_lastPressedAt!).inSeconds } ==== ${Duration(seconds: 2).inSeconds}");
canPopNow = false;
}else{
SystemNavigator.pop();
canPopNow = true;
}
}
},
child: Scaffold(
Подробнее здесь: https://stackoverflow.com/questions/792 ... in-flutter