You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using Android.App;
|
|
|
|
|
using Android.Content;
|
|
|
|
|
using Android.OS;
|
|
|
|
|
using Android.Runtime;
|
|
|
|
|
using Android.Views;
|
|
|
|
|
using Android.Widget;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace PhilExample.Droid.Utils
|
|
|
|
|
{
|
|
|
|
|
internal static class NotificationHelper
|
|
|
|
|
{
|
|
|
|
|
internal static NotificationManager GetAndroidNotificationManager() => (NotificationManager)MainActivity._THIS.GetSystemService(Context.NotificationService);
|
|
|
|
|
|
|
|
|
|
internal static void CreateNotificationChannel(string id, string name, string descr)
|
|
|
|
|
{
|
|
|
|
|
if (Build.VERSION.SdkInt < BuildVersionCodes.O)
|
|
|
|
|
{
|
|
|
|
|
// Notification channels are new in API 26 (and not a part of the
|
|
|
|
|
// support library). There is no need to create a notification
|
|
|
|
|
// channel on older versions of Android.
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var channel = new NotificationChannel(id, name, NotificationImportance.High)
|
|
|
|
|
{
|
|
|
|
|
Description = descr
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
GetAndroidNotificationManager().CreateNotificationChannel(channel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|