• Mobile
  • Extensions
  • Releases
  • GitHub
  • Blog
  • Sponsor
Show / Hide Table of Contents
  • Mobile
    • v3.0.0 ALPHA
    • v2.5.0 (Stable)
    • v2.x
    • v1.x
  • Extensions
    • v1.3.0

3.0.0 ALPHA

Important
  • This is an EARLY ALPHA release! There are big changes planned! We are not taking bugs on things at this time. Hosting has vastly changed in our model to support MAUI.

  • We have also removed several components such as AppCenter Logging and Firebase on iOS due to incompatible .NET6 iOS dependencies

  • Generators have been removed temporarily. It has not been decided how/if we will support them in the future.

  • We are currently only supporting .NET 6 targets for iOS, MacCatalyst, and Android

Note

Shiny.Extensions.Configuration (Xamarin version of Microsoft.Extensions.Configuration) is now part of this repository

MAUI

  • Shiny.Hosting.Maui initial integration package created (Example how to setup shown below)

Core

  • [BREAKING] IShinyStartup is gone - we now have a new HostBuilder pattern to allow classic to align with MAUI/NET6. Use extensions methods to build on this for classic/non-MAUI setups
  • [BREAKING] IShinyModule is gone - use extensions methods instead
  • [BREAKING] Connectivity is gone (well, it was moved to jobs since it was only really used by jobs) - Switch to MAUI Essentials if you need it
  • [BREAKING] PowerManager is gone - moved to jobs as well - Switch to MAUI Essentials if you need it
  • [Enhancement] IShinyStartupTask and INotifyPropertyChanged persistent services are now registered using the service collection extension .AddShinyService during your bootstrapping
  • [Enhancement] New internal repository pattern is faster and easier to test
  • [Enhancement] New hosting model that will support classic Xamarin, MAUI, and other platforms going forward
  • [Enhancement] New internal lifecycle processor
  • [Enhancement] New "plugin" model - check out example below

Jobs

  • [BREAKING][iOS] We no longer support the background fetch style (old) job management - only bgtasks will be used going forward

HTTP Transfers

  • [BREAKING] The android native process is gone in favour of a new foreground service for uploads & downloads

MAUI Setup

  1. Install Shiny.Hosting.Maui
  2. Install the nuget package(s) shown above each comment below to get that functionality
  3. Ensure you add UseShiny as shown below
using Shiny;

namespace Sample;


public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp
            .CreateBuilder()            
            .UseMauiApp<App>()
            // THIS IS REQUIRED TO BE DONE FOR SHINY TO RUN
            .UseShiny();

        // shiny.sensors
        builder.Services.AddAllSensors();

#if !MACCATALYST
        // shiny.nfc - ios & android only
        builder.Services.AddNfc();
#endif

        // shiny.locations
        builder.Services.AddGps<SampleGpsDelegate>();
        builder.Services.AddGeofencing<SampleGeofenceDelegate>();
        builder.Services.AddMotionActivity();

        // shiny.notifications
        builder.Services.AddNotifications<SampleNotificationDelegate>();

        // shiny.bluetoothle
        builder.Services.AddBluetoothLE<SampleBleDelegate>();

        // shiny.bluetoothle.hosting
        builder.Services.AddBluetoothLeHosting();

        // shiny.beacons
        builder.Services.AddBeaconRanging();
        builder.Services.AddBeaconMonitoring<SampleBeaconMonitorDelegate>();

        // shiny.net.http
        builder.Services.AddHttpTransfers<SampleHttpTransferDelegate>();

        // shiny.speechrecognition
        builder.Services.AddSpeechRecognition();

        // shiny.push
        builder.Services.AddPush<SamplePushDelegate>();

        // shiny.jobs
        builder.Services.AddJob(typeof(SampleJob));
        builder.Services.AddJobs(); // not required if using above

        // shiny.core - startup task & persistent service registration
        builder.Services.AddShinyService<StartupTask>();

        return builder.Build();
    }
}
Warning

Currently, you will need to add the following to your MAUI project to compile with Shiny

    <ItemGroup Condition="'$(TargetFramework)' == 'net6.0-android'">
        <!--needed by ALL shiny packages-->
        <PackageReference Include="Xamarin.AndroidX.Core" Version="1.7.0.2" />
        <PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.4.1.1" />
        <PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="2.4.1.1" />

        <!--needed by Shiny.Jobs-->
        <PackageReference Include="Xamarin.AndroidX.Work.Runtime" Version="2.7.1.3" />

        <!--needed by Shiny.Notifications & Shiny.Locations-->
        <PackageReference Include="Xamarin.GooglePlayServices.Location" Version="119.0.1" />

        <!--needed by Shiny.Push.*-->
        <PackageReference Include="Xamarin.Firebase.Messaging" Version="122.0.0.5" />
    </ItemGroup>

NEW "Plugin" Model

  1. Install Shiny.Core
  2. Install the plugin package(s) you need
  3. From your Android Application.OnCreate (not main activity) or iOS AppDelegate.OnFinishedLauching, call the following:

ShinyContainer.Init(builder => 
{
    builder.Services.AddShinyStuff();
});

// to call within your code, simply use:
ShinyContainer.Current.GetService<IAShinyService>();

// most libraries (ie. BluetoothLE) offer easy ways to get at the service like
var manager = ShinyContainer.Current.BluetoothLe();
Warning

Using the ShinyContainer does NOT negate the need for the standard boilerplate within your head projects

  • Improve this Doc
In This Article
Back to top Generated by DocFX