0

.NET MAUI app, created a new project and added "LaunchMode = LaunchMode.SingleTask" to the MainActivity.cs attribute.(Activity is only in MainActivity.cs)
Repeatedly launching the application and deleting the app from the Task Manager will call CreateMauiApp() in MainApplication.cs.
App() in App.xaml.cs, until initialization of MainPage is executed. However, the app is not displayed.
When the app is started after this, it is called from OnStart() in App.xaml.cs.
How can I prevent CreateMauiApp() in MainApplication.cs from being called after the app is closed?

  • AutoRemoveFromRecents = true -> not worked.
  • NoHistory = true -> not worked.(Disappearing when it goes to the background is not what I want to do.)
  • App.Current.Quit() in OnDestroy(). -> not worked.(OnDestroy() is not called when I exit from the task manager.)
ka5u8
  • 1
  • 2
  • SingleTask launch mode creates a new task and brings any existing task containing the same activity to the foreground. The OnCreate() method should not be called when the Maui app is closed and reopened. You can report it on the GitHub issue. – Guangyu Bai - MSFT Aug 02 '23 at 09:46
  • @GuangyuBai-MSFT As you commented, I would like to report this in a Github Issue. Thank you for your comment. – ka5u8 Aug 03 '23 at 01:35

0 Answers0