Shiny.NET
Platform - UWP

UWP

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

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

using Microsoft.Extensions.DependencyInjection;
using Shiny;

namespace YourNamespace
{
    public class YourShinyStartup : ShinyStartup
    {
        public override void ConfigureServices(IServiceCollection services, IPlatform platform)
        { 
            
<p>services. 
        }
    }
}

Minimum Version: 8.0

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.org.yourapp" android:installLocation="preferExternal">
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.BATTERY_STATS" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
</manifest>

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)
<Extensions>
    <Extension Category="windows.backgroundTasks" EntryPoint="FullNamespaceToYour.ShinyBackgroundTask">
        <BackgroundTasks>
            <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"/>
        </BackgroundTasks>
    </Extension>
</Extensions>

On This Page

UWP

Edit This Page