Override create window to fix android crash
This commit is contained in:
parent
34caee585f
commit
d6a33fb793
2 changed files with 8 additions and 2 deletions
|
@ -3,10 +3,16 @@
|
||||||
public App(NavigatorService navigatorService) {
|
public App(NavigatorService navigatorService) {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
MainPage = new AppShell();
|
//MainPage = new AppShell();
|
||||||
NavigatorService = navigatorService;
|
NavigatorService = navigatorService;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal NavigatorService NavigatorService { get; private set; }
|
internal NavigatorService NavigatorService { get; private set; }
|
||||||
|
|
||||||
|
protected override Window CreateWindow(IActivationState? activationState) {
|
||||||
|
// always create new windows. This allows share intents to not crash on android
|
||||||
|
// (with the side effect that multiple windows are opened, which is messy but better than a crash)
|
||||||
|
return new Window(new AppShell());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||||
using Neighbourhood.omg.lol.Models;
|
using Neighbourhood.omg.lol.Models;
|
||||||
|
|
||||||
namespace Neighbourhood.omg.lol {
|
namespace Neighbourhood.omg.lol {
|
||||||
[Activity(Theme = "@style/Maui.SplashTheme", LaunchMode = LaunchMode.SingleTop, MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
|
[Activity(Exported = true, Theme = "@style/Maui.SplashTheme", LaunchMode = LaunchMode.SingleTop, MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
|
||||||
[IntentFilter([Intent.ActionSend], Categories = [Intent.CategoryDefault], DataMimeType = "text/plain")]
|
[IntentFilter([Intent.ActionSend], Categories = [Intent.CategoryDefault], DataMimeType = "text/plain")]
|
||||||
[IntentFilter([Intent.ActionSend], Categories = [Intent.CategoryDefault], DataMimeType = "*/*")]
|
[IntentFilter([Intent.ActionSend], Categories = [Intent.CategoryDefault], DataMimeType = "*/*")]
|
||||||
public class MainActivity : MauiAppCompatActivity {
|
public class MainActivity : MauiAppCompatActivity {
|
||||||
|
|
Loading…
Reference in a new issue