Mobile Notifications

Mobile Push Notifications
Keep your players engaged


Get it from Asset Store - Mobile Push Notifications
For detailed implementation instructions see the Documentation

Key Features:

  • Increase your game engagement by sending notifications.
  • Schedule local notifications with a single line of code.
  • Click callback with custom message for each notification to track app sessions started by notification press.
  • Custom notification icons.
  • Custom notification text.
  • Device restart support.
  • Works for Android and iOS without any changes…
  • Full code and demo scene included.
  • Works with Unity 2019 and above with Free, Plus or Pro license.
  • Requires Mobile Notifications package from Unity.

Currently supported platforms:

  • Android
  • iOS

Simple code that works for supported platforms without any change:

  • Initialize Notification Plugin
void Start()
{
        GleyNotifications.Initialize();
        openText.text=GleyNotifications.AppWasOpenFromNotification();
}
  • Preparing Notification
/// <summary>
/// Schedule a notification
/// </summary>
/// <param name="title">Title of the notification</param>
/// <param name="text">Content of the notification</param>
/// <param name="timeDelayFromNow">delay to display the notification, this delay will be added to current time</param>
/// <param name="smallIcon">name of the custom small icon from Mobile Notification Settings</param>
/// <param name="largeIcon">name of the custom large icon from Mobile Notification Settings</param>
/// <param name="customData">this data can be retrieved if the users opens app from notification</param>

GleyNotifications.SendNotification("Game Title", "Notification body", new System.TimeSpan(hours, minutes, seconds), "small_icon_name", "large_icon_name", "Optional message if app is opened from notification");

A step by step integration tutorial is available here:

1 Like

Hey; looking good!

Aside from what it seems as understanding of what was really needed as plugin I like the effort with details.
Will buy for sure.

Quick question tho; might be a good first question :smile:

So, just to be sure, when you say that Initialize() starts up notification channel and cancels all pending notifications, what is then the exact flow or setup that works best if I want to send 1 notification every 24h to the user (or by any similar repeating rule)?

Thank you!

Hello,
We have a complete implementation example in our test scene, but i will explain it to you for a better understanding.
If you schedule a notification in 24 hours, and your user enters in your app before, lets say 23:59 your user will be inside your app and you want to cancel all pending notifications because your user is already in your app, you do not want him to be notified that something happen in you app, a bonus is available, because he is inside your app and it will know.

And the implementation goes something like this:

 private void OnApplicationFocus(bool focus)
{
        if(focus == false)
        {
            //if user left your app schedule all your notifications
            GleyNotifications.SendNotification("Game Title", "App was minimized", new System.TimeSpan(0, 1, 0), null, null, "Opened from Gley Minimized Notification");
        }
        else
        {
            //call initialize when user returns to your app to cancel all pending notifications
            GleyNotifications.Initialize();
        }
}

Hi,
How to send noti at certain time every day?

Hello,
Since our plugin is not a server side plugin you have to manually compute that time difference from DateTime.now and DateTime you want to send the notification and schedule the notification using that difference.

Hello,
I recently buy you plugin but it seems not working properly,
I downloaded your example app .apk it’s working with it but when I do in my project it’s not working (like there is something I should do but not mentionet anywhere)
I just open a new empty project and just added your plugin and build with your example scene = it’s not working
What am I missing ?

Here is Error code :

2020-03-04 17:06:01.890 ? E/Unity: AndroidJavaException: java.lang.NoSuchMethodError: no static method with name='findResourceidInContextByName' signature='(Ljava/lang/Object;Landroid.app.Application;Lcom.unity3d.player.UnityPlayerActivity;)I' in class Lcom.unity.androidnotifications.UnityNotificationManagerOreo;
    java.lang.NoSuchMethodError: no static method with name='findResourceidInContextByName' signature='(Ljava/lang/Object;Landroid.app.Application;Lcom.unity3d.player.UnityPlayerActivity;)I' in class Lcom.unity.androidnotifications.UnityNotificationManagerOreo;
        at com.unity3d.player.ReflectionHelper.getMethodID(Unknown Source:180)
        at com.unity3d.player.UnityPlayer.nativeFocusChanged(Native Method)
        at com.unity3d.player.UnityPlayer.a(Unknown Source:0)
        at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:177)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:201)
        at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
      at UnityEngine._AndroidJNIHelper.GetMethodID (System.
1 Like

Hello,
Please follow our youtube tutorial ad it should work. If not let us know.

Bought your asset… question: on iOS, there is a setting for requesting authorization when the app starts… I don’t want that… how do I request authorization later?

Hello,
Please read the official unity documentation from section iOS → Request Autorization from here:
https://docs.unity3d.com/Packages/com.unity.mobile.notifications@1.0/manual/index.html

I can’t get any of that to work using BOLT. I’d like to request this as a feature.

I will add this into our To Do list and it will be added in our next update.

1 Like

Using BOLT I’ve noticed that when I set up a notification using a time from now unit (as opposed to the timespan unit) it only pushes the last one… is that by design or is that a bug?

Hello,
Are you using the latest version of our plugin?
Please update the plugin.

I see that this is fixed in an update to the push asset in ver 1.1.2 by itself but I bought the Mobile Tools package… it says I have the latest version and this update is not there

Hello,
We will update mobile tools as well on Monday, and it should be live on asset store in a couple of days. If you need it sooner please write us at gley.assets@gmail.com send us your invoice number and we will send it to you sooner.
Thank you!

1 Like

Will this be the update that will include the request authorization for push later as opposed to at app start as we discussed earlier in this thread?

Hello,
The authorization is not a priority right now, we have more important and urgent issues to deal with right now.
Thank you for understanding

Thank you for updating Mobile Tools, that fixed the issue of only one push being scheduled, however, now all my notifications are doubled… two get pushed for every notification

Hello,
Please verify your code and make sure it doesn`t run twice.
If not, you can prepare a test project and send it to us at gley.asset@gmail.com to be able to reproduce your issue. Thank you!

Turns out on iOS if you have OnAppPause and OnAppQuit going to the same set of checks for what to push, it will come twice… I had to put an init/clear after quit and before the check to clear the pause push… works now… thank you for the update!