Skip to content

Native & Classic Xamarin

If you already have a complex or implemented classes for the platform boilerplate, please follow the manual hooks guide. This is designed to get you up and running quickly on full .NET native platforms.

First, install

iOS/Mac Catalyst

This is the basic requirement for

using Shiny;
using Shiny.Hosting;
using Foundation;
using UIKit;
namespace YourNamespace;
public class MyDelegate : Shiny.ShinyAppDelegate
{
protected override IHost CreateShinyHost()
{
var builder = HostBuilder.Create();
// register all of your services and shiny modules here
return builder.Create();
}
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// any launch stuff you require - don't call shiny stuff BEFORE the line below
return base.FinishedLaunching(application, launchOptions);
}
}

Android

Create a MainApplication class and inherit Shiny.ShinyAndroidApplication

using System;
using Android.App;
using Android.Runtime;
using Shiny.Hosting;
namespace YourNamespace;
public class YourShinyAndroidApplication : Shiny.ShinyAndroidApplication
{
// this is required for .NET Android
public ShinyAndroidApplication(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer) {}
protected override IHost CreateShinyHost()
{
var builder = HostBuilder.Create();
// register all of your services and shiny modules here
return builder.Build();
}
}

Next, add a new main activity (or have all of your activities inherit) Shiny.ShinyAndroidActivity

using Android.App;
using Android.Content.PM;
namespace YourNamespace;
[Activity(
Theme = "@style/YourTheme",
MainLauncher = true,
ConfigurationChanges =
ConfigChanges.ScreenSize |
ConfigChanges.Orientation |
ConfigChanges.UiMode |
ConfigChanges.ScreenLayout |
ConfigChanges.SmallestScreenSize |
ConfigChanges.Density
)]
public class MainActivity : Shiny.ShinyAndroidActivity
{
}