Local Notifications

To use Local Notifications you have Setup Local Notifications Settings in Inspector window.


Next Settings available:

  • Enable/Disable Show in foreground.
  • Enable/Disable Notification Vibration.
  • Setup Notification Large Icon.
  • Setup Notification Small Icon.
  • Setup Notification Sound.

Here is the simple example how to schedule local notifications, with will be fired in 5 seconds

int NotificationId = AndroidNotificationManager.instance.ScheduleLocalNotification("Hello", "This is local notification", 5);

If you don't set up Local Notification settings in Inspector, then default settings will be applied (default vibration, Application Icon for Local Notifications, defaut sound).

The NotificationId can be used to cancel the notification.


Or you can also cancel all scheduled local notifications using:


To find out pending notification list, use:

List<LocalNotificationTemplate> PendingNotofications;

PendingNotofications = AndroidNotificationManager.instance.LoadPendingNotifications();

Launch Notification

You can also find out if the app was launched with the click by local notifications. And here is an example how:

//listening for load event
AndroidNotificationManager.instance.OnNotificationIdLoaded += OnNotificationIdLoaded;

//loading app laucnh notifications id

private void OnNotificationIdLoaded (int notificationid){

    Debug.Log "App was laucnhed with notification id: " + notificationid);


If the returned notification is “-1” it means that the app wasn’t launched by clicking on local notification. But if it was will contain an id of notification with was used to launch the app.

Note: Restoring from background using click on local notification will not update

Toast Notification

You can always show simple toast notification as showed on the code bellow:

string messagae = "Hello";
int duration = 5 //sec
AndroidNotificationManager.Instance.ShowToastNotification(messagae, duration);

Advanced Local Notifications API

For more experienced developers there is another option for using Local Notifications.

Instead of passing notification title, notification message and notification time to ScheduleLocalNotification of AndroidNotificationManager, you can use AndroiNotificationBuilder instance to access more advanced API for creating Local Notifications.

AndroiNotificationBuilder class has next methods for Local Notification setup:

public void SetSoundName(string sound)
public void SetIconName(string icon)
public void SetVibration(bool vibration)
public void SetSilentNotification()

For using AndroiNotificationBuilder just create instance of this class and pass it to ScheduleLocalNotification method as shown below:

AndroidNotificationBuilder builder = new AndroidNotificationBuilder (ID, "Title", "Notification Message", 5);
AndroidNotificationManager.instance.ScheduleLocalNotification (builder);

In this case such local notification settings as icon, sound and vibration will be used from Inspector settings.

To create local notification using advanced API just use additional methods of AndroiNotificationBuilder:

AndroidNotificationBuilder builder = new AndroidNotificationBuilder (ID, "Title", "Notification Message", 5);
builder.SetIconName ("notification_icon_name");
builder.SetSoundName ("notification_sound_name");
builder.SetVibration (true);

AndroidNotificationManager.instance.ScheduleLocalNotification (builder);

Use SetSilentNotification method to create notification with NO sound and NO vibration.

AndroidNotificationBuilder builder = new AndroidNotificationBuilder (ID, "Title", "Notification Message", 5);
//Use notification with NO sound and with NO vibration
builder.SetSilentNotification ();

AndroidNotificationManager.instance.ScheduleLocalNotification (builder);


All icons and sound for local notifications, that you will use in your Application, should be saved in Plugins/Android/AN_Res/res/drawable and Plugins/Android/AN_Res/res/raw accordingly.

For local notification icons:


For local notification sounds:


So, using advanced Local Notifications API, you can use in your application as many local notifications with different icon/sound/vibration options as you need.

Important: All icons/sounds resources should be named in lowercase.

Check if  Notifications are ON?

The common questions: How to check programmatically if user turn off push notification in app settings?

It is asked in this video and the Project lead for the new notifications declares that you can't. Youtube video link.

Can I open app settings intent directly from the app to prompt user to turn it on? - Yes, this is possible with the Settings Page API.

Example Scenes

  • Assets/Extensions/AndroidNative/xExample/Scenes/Other/Notifications