Home

Awesome

UniLocalNotification

UnityVersion AndroidStudioVersion License


Simple Local Notification Plugins for Unity

Description

UniLocalNotification - It's a plugin for implementing local notification easily. It can hide processing by platform and register local notification with single code. And several convenient methods are also implemented.

Example Demo

Requirement

Unity5 or higher

Support Platform

iOS, Android

Usage

Initialize

Initialize the plugin. Plese call the method at the beginning of your app every time.

UniLocalNotification.Initialize();

Register Local Notification

Register local notification to device. The third argument only use android platform.

// Notify in 10 seconds
int delay = 10;
UniLocalNotification.Register(delay, "message", "title");

Cancel Local Notification

Cancell all local notifications registered

UniLocalNotification.CancelAll();

Check Permission

To check whether the user has allowed the notification

bool isPermitted = UniLocalNotification.IsLocalNotificationPermitted();

Open App Settings

Open application settings (to allow users to register notifications)

UniLocalNotification.OpenAppSetting();

Install

Use unitypackage at the relase page.

Change Notification Icon at Android Status Bar

Android status bar icons should be 32-bit PNGs with an alpha channel for transparency. So, you can change the icon by creating your aar library.

  1. Open AndroidLibraryProject by Android Studio.
  2. Replase notification icon at the "unilocalnotification/src/main/res/drawable/notification_icon.png".
<img src="./images/aar_create_1.png" width="500">
  1. Create AAR

    Go to android project root and type "./gradlew assemble".

<img src="./images/aar_create_2.png" width="500">
  1. Find AAR At "unilocalnotification/build/outputs/aar/".
<img src="./images/aar_create_3.png" width="500">
  1. Replace AAR at the unity project.

Licence

MIT

Author

sanukin39