Platform - UWP


  1. In order to process background tasks, you first need to create a "Windows Runtime Library"
  1. Add

|Area|Info| |---|---| |Description|| |Service|Shiny.IPlatform| |NuGet|| |Static Generated Class||

using Microsoft.Extensions.DependencyInjection;
using Shiny;

namespace YourNamespace
    public class YourShinyStartup : ShinyStartup
        public override void ConfigureServices(IServiceCollection services, IPlatform platform)

Minimum Version: 8.0

Minimum Version: 10

No Special Configuration Required

nuget to this new library.
  1. Add a references to your shared/netstandard library

  2. Add a class and call the following hook to Shiny

using System;
using Windows.ApplicationModel.Background;
using Shiny;

namespace Samples.UWP
    public sealed class MyShinyBackgroundTask : IBackgroundTask
        public void Run(IBackgroundTaskInstance taskInstance)
            => this.ShinyRunBackgroundTask(taskInstance, new YourSharedLibrary.YourStartup());

  1. Now add this "Windows Runtime Library" as a reference to your head UWP project.

  2. Add the following to your App.xaml.cs constructor in your head UWP project (Note the generic reference to your new runtime component)

this.ShinyInit<YourShinyBackgroundTask>(new YourSharedLibrary.YourStartup());
  1. In your Package.appxmanifest, add the following under the Application node (NOTE: the permissions you use will depend on the libraries from Shiny that you use)
    <Extension Category="windows.backgroundTasks" EntryPoint="FullNamespaceToYour.ShinyBackgroundTask">
            <Task Type="bluetooth"/>
            <Task Type="deviceConnectionChange"/>
            <Task Type="deviceServicing"/>
            <Task Type="deviceUse"/>
            <Task Type="general"/>
            <Task Type="location"/>
            <Task Type="systemEvent"/>
            <Task Type="pushNotification"/>
            <Task Type="timer"/>

On This Page


Edit This Page