Skip to content

Getting Started

Setup

Shiny.Notifications
Shiny.Hosting.Maui

You may ask “what does local notifications” have to do with device or background services? Well… turns out quite a bit. You need a way of letting your users know that you’ve done something in the background. Maybe your job ran and determined that you need to do something OR you connected to a BLE peripheral… who knows, but you’ll definitely need local notifications at some point well using Shiny

iOS Specifics

There isn’t anything specific to setting up local notifications on iOS. However, iOS has one specific rule - While the application is running in the FOREGROUND, notifications will not be displayed. You are responsible for notifying your users of actions happening while your app is running.

Android Specifics

Android has many different customization points - please review the Android Specifics Documentation

Notifications

First rule, as with any Shiny service. Run RequestAccess

var result = await ShinyHost.Resolve<INotificationManager>().RequestAccess();
if (result == PermissionState.Available) {
// ... do something
}

Send a Notification

TODO

Getting A List of Pending Notifications

TODO

Cancelling Individual or All Pending Notifications

TODO

Geofencing

TODO

Scheduling

iOS requires the ‘Time Sensitive Notification’ entitlement that is setup for your app on the Apple Developer Portal.

You must then add the following to your ‘Entitlement.plist’ or csproj file

<key>com.apple.developer.usernotifications.time-sensitive</key>
<true />
<!-- OR -->
<ItemGroup>
<CustomEntitlements Include="com.apple.developer.usernotifications.time-sensitive" Type="Boolean" Value="true" />
</ItemGroup>

TODO

Repeat Intervals

TODO

Notification Responses

using System.Threading.Tasks;
using Shiny.Notifications;
public class NotificationDelegate : INotificationDelegate
{
public async Task OnEntry(NotificationResponse response)
{
}
}

Android Notification Entry

In order for Shiny to receive Android notification entries, you must add the following to your MainActivity.cs file

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