Skip to content

A Zebble plugin that enables you to send or schedule native local notifications

Notifications You must be signed in to change notification settings

Geeksltd/Zebble.LocalNotification

Repository files navigation

Zebble.LocalNotification

logo

A consistent and easy way to show local notifications in Zebble apps.

NuGet

With local notifications, your app configures the notification details locally and passes those details to the system, which then handles the delivery of the notification when your app is not in the foreground. Local notifications are supported on iOS, Android and UWP.


Setup


Api Usage

Call Zebble.Device.LocalNotification from any project to gain access to APIs.

Display a local notification immediately:
await LocalNotification.Show("Test", "This is the body message");
Display a local notification at a scheduled time :
await LocalNotification.Schedule("Test", "This is the body message", DateTime.Now.AddSeconds(30), 1);

Platform Specific Notes

Some platforms require certain permissions or settings before it will display notifications.

Android

In android project of Zebble application you should call Initialize method in OnCreate method of MainActivity class like below code:

await LocalNotification.Initialize(Intent);

So, your MainActivity will look like this:

protected override async void OnCreate(Bundle bundle)
{
    base.OnCreate(bundle);
    SetContentView(Resource.Layout.Main);

    await LocalNotification.Initialize(Intent);

    Setup.Start(FindViewById<FrameLayout>(Resource.Id.Main_Layout),this).RunInParallel();
    await (StartUp.Current = new UI.StartUp()).Run();
}

iOS

Call Initialize method of LocalNotification in FinishedLaunching method of AppDelegate class:

public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
     var result = base.FinishedLaunching(application, launchOptions);

     LocalNotification.Initialize(launchOptions);

     return result;
}

Events

Event Type Android iOS Windows
Tapped AsyncEvent<KeyValuePair<string, string>[]> x x x

Methods

Method Return Type Parameters Android iOS Windows
Show Task<bool> title -> string
body -> string
x x x
Schedule Task<bool> title -> string
body -> string
notifyTime -> DateTime
id -> int
x x x
Cancel Task id -> int x x x
Initialize Task options -> object x x x

About

A Zebble plugin that enables you to send or schedule native local notifications

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages