Awesome
UniLocalNotification
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.
- Open AndroidLibraryProject by Android Studio.
- Replase notification icon at the "unilocalnotification/src/main/res/drawable/notification_icon.png".
-
Create AAR
Go to android project root and type "./gradlew assemble".
- Find AAR At "unilocalnotification/build/outputs/aar/".
- Replace AAR at the unity project.