[RELEASED] UTNotifications - Professional Cross Platform Push Notifications and More

Unity 5+ / Unity 4.6.9+
Cross-platform: iOS, Android (with Google Cloud Messaging or Amazon Device Messaging), Windows Store (Windows Phone 8.1 / Windows 8.1 / Universal 8.1 / Universal 10)

UTNotifications is an advanced and professional Unity extension that is yet very convenient and easy to use. It provides a convenient cross-platform API for posting and handling local, scheduled (including those appearing once and those repeating) and push notifications. It fully supports iOS,Android (Google Play and Amazon Kindle Android devices) and Windows Store (Windows Phone 8.1, Windows 8.1/10, Universal 8.1, Universal 10).

Features:

  • Immediate local notifications.
  • Scheduled (those appearing once and those repeating) local notifications with automated restoring on device reboot.
  • Push notifications with a workaround for a Unity bug (APNS that do not work in iOS 8 with Unity versions prior 4.6).
  • 2 Android push notifications services: Google Cloud Messaging (GCM) & Amazon Device Messaging (ADM) in a single build.
  • Completely cross-platform API.
  • The full source code is provided as well as the code of the native plugins so one can change and adjust anything one likes.
  • A demo push notifications provider web server with the source code is included and it supports all three push notifications services.
  • Default or custom notifications sounds and icons.
  • A detailed manual and an API Reference docs are included.
  • Convenient Unity editor extension for configuring.
  • Android & Windows Store manifest file automated patching.
  • Notifications enabling/disabling API for all supported platforms allows one to add notifications toggle to the game options.
  • The API for handling the received notifications of any type both local and push.
  • One can attach custom data to the notification of any type and access it while processing the received notification.
  • Hiding or cancelling a specific notification or all of them.
  • iOS application icon badge number management API.
  • Android grouped notifications.
  • A sample & test scene.

API Reference
Manual
Both the API Reference and the detailed step-by-step manual can be found under Assets/UTNotifications/Documentation (can be also opened from the Unity menu: Edit → Project Settings → UTNotifications)

Universal Tools asset.
See also our new UTMail - Email Composition and Sending Plugin.

Hi Yuriy,
nice job!

I have got some questions:

  1. does it support notification types ? For example grouped notifications for android. Is this flexible to be set up?
  2. does it give me an option to turn off the notifications while the app is open?

Thanks.

Hey rkamalya,
Thank you, I’m glad that you like the asset.

1. does it support notification types ? For example grouped notifications for android. Is this flexible to be set up?
Updated: supported directly since version 1.3
Obsolete: No, it’s not supported directly now (but you can easily add it on your own as you have the plugin’s source code). Here is what you need to know for that. I’ve also created a task to implement the notifications grouping directly in a future release.

2. does it give me an option to turn off the notifications while the app is open?
Updated: supported directly since version 1.3
Obsolete: Yes, and you have more than one option here. First, if you still need to know when the notification was received, you can handle the notifications using UTNotifications.Manager.Instance.OnNotificationsReceived event. There you can hide any received notifications using UTNotifications.Manager.Instance.HideNotification and also do something else (what you need). There is another option: when the app is started you can call UTNotifications.Manager.Instance.SetNotificationsEnabled(false) and when it’s being closed UTNotifications.Manager.Instance.SetNotificationsEnabled(true). The second option allows you to work with notifications the same way as they are enabled, but you’ll not receive them. But the scheduling and so on will work fine and after you enable notifications before the application exit, they will be able to be displayed again.

Best regards,
Yuriy, Universal Tools team.

An update (1.2) is available!

Changes:

  • Triggering scheduled notifications after a device reboot on Android
  • Custom sounds & icons support
  • Android 4.4 compatibility mode option
  • Base64 or HEX encoding for APNS registration token
  • Bugfixes

Notification will work if phone is rebooted?

Thanks for your answer.
The second option is not suitable for me, because I can’t handle all the ways users quit my application. And as for the first option (calling HideNotification in OnNotificationsReceived event) it showed me the notification and then hid it. Am I doing something wrong ?

Well, yes, if the notification is not processed fast enough (it depends on a frame rate and the Unity ↔ Android Plugins interaction speed) then you still will be able too see a notification.
For the second option you can handle the application exit in a OnApplicationQuit().
I also created a ticket to implement that option in a next update to make it as reliable as possible.

Hi imtrobin,
Yes, since the version 1.2 (already available in the Asset Store).

Thanks!

p.s. Eager to see flexible notification options (grouping and etc) soon.

Version 1.3 containing the requested features and bugfixes has just been uploaded! It will be available in about 1 week (because of the Unity Asset Store approval procedure).

Do you think you will support WP8 anytime in the future?

Hi g3tinmybelly,
We have such plans, but currently there are no estimations for it. We will hardly add WP8 support until October.

Best regards,
Yuriy, Universal Tools team.

UTNotifications 1.3 is now available!

Changes:

  • Android grouped notifications.
  • Android option for showing notifications only if app is not running or is in background.
  • Bugfixes

Hi, I’m new to Notifications and Android, but got it up running really fast and easy. Thanks for this great plugin.
iOS works very well, but I have a problem on Android:
I’m sending notifications from nodejs with node-gcm. When the android device recieves the notification, the app crashes, even when it’s in background.
Logcat says this:

D/PowerManagerService( 503): acquireWakeLock(4186ece8): PARTIAL_WAKE_LOCK , tag=GTALK_CONN, flags=0x1, pid=4865, uid=10023

D/PowerManagerService( 503): releaseWakeLock(4186ece8): PARTIAL_WAKE_LOCK , tag=GTALK_CONN, flags=0x1

D/PowerManagerService( 503): acquireWakeLock(4182e240): PARTIAL_WAKE_LOCK , tag=GTALK_CONN, flags=0x1, pid=4865, uid=10023

D/PowerManagerService( 503): acquireWakeLock(41817648): PARTIAL_WAKE_LOCK , tag=GOOGLE_C2DM, flags=0x1, pid=4865, uid=10023

D/PowerManagerService( 503): releaseWakeLock(4182e240): PARTIAL_WAKE_LOCK , tag=GTALK_CONN, flags=0x1

D/PowerManagerService( 503): acquireWakeLock(416ca4d0): PARTIAL_WAKE_LOCK , tag=wake:com.abda.quizzin/universal.tools.notifications.GcmIntentService, flags=0x1, pid=24347, uid=10191

D/PowerManagerService( 503): releaseWakeLock(41817648): PARTIAL_WAKE_LOCK , tag=GOOGLE_C2DM, flags=0x1

W/dalvikvm(24347): threadid=13: thread exiting with uncaught exception (group=0x40dcaa08)

D/PowerManagerService( 503): releaseWakeLock(416ca4d0): PARTIAL_WAKE_LOCK , tag=wake:com.abda.quizzin/universal.tools.notifications.GcmIntentService, flags=0x1

E/AndroidRuntime(24347): FATAL EXCEPTION: IntentService[GcmIntentService]

E/AndroidRuntime(24347): java.lang.Error: FATAL EXCEPTION [IntentService[GcmIntentService]]

E/AndroidRuntime(24347): Unity version : 5.1.1f1

E/AndroidRuntime(24347): Device model : HTC HTC One X

E/AndroidRuntime(24347): Device fingerprint: htc/htc_europe/endeavoru:4.2.2/JDQ39/231174.4:user/release-keys

E/AndroidRuntime(24347):

E/AndroidRuntime(24347): Caused by: java.lang.NullPointerException

E/AndroidRuntime(24347): at libcore.net.UriCodec.decode(UriCodec.java:153)

E/AndroidRuntime(24347): at java.net.URLDecoder.decode(URLDecoder.java:45)

E/AndroidRuntime(24347): at universal.tools.notifications.Manager.prepareNotification(Manager.java:298)

E/AndroidRuntime(24347): at universal.tools.notifications.Manager.postNotification(Manager.java:138)

E/AndroidRuntime(24347): at universal.tools.notifications.Manager.postPushNotification(Manager.java:154)

E/AndroidRuntime(24347): at universal.tools.notifications.GcmIntentService.onHandleIntent(GcmIntentService.java:24)

E/AndroidRuntime(24347): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)

E/AndroidRuntime(24347): at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(24347): at android.os.Looper.loop(Looper.java:158)

E/AndroidRuntime(24347): at android.os.HandlerThread.run(HandlerThread.java:60)

E/EmbeddedLogger( 503): App crashed! Process: com.abda.quizzin

E/EmbeddedLogger( 503): App crashed! Package: com.abda.quizzin v1 (1.0)

W/ContextImpl( 503): Failed to check package’s status, pkg:com.abda.quizzin

W/ContextImpl( 503): android.content.pm.PackageManager$NameNotFoundException: Application package com.abda.quizzin is uninstalling.

W/ContextImpl( 503): at android.app.ContextImpl.createPackageContextAsUser(ContextImpl.java:2028)

W/ContextImpl( 503): at android.app.ContextImpl.createPackageContext(ContextImpl.java:2006)

W/ContextImpl( 503): at com.htc.server.embedded.EmbeddedLogger.onHandleApplicationCrashV2(EmbeddedLogger.java:66)

W/ContextImpl( 503): at com.android.server.am.HtcAmsCallbackManager.handleApplicationCrash(HtcAmsCallbackManager.java:858)

W/ContextImpl( 503): at com.android.server.am.HtcAmsCallbackManager.handleAmsCallback(HtcAmsCallbackManager.java:312)

W/ContextImpl( 503): at com.android.server.am.HtcAmsCallbackManager.access$200(HtcAmsCallbackManager.java:34)

W/ContextImpl( 503): at com.android.server.am.HtcAmsCallbackManager$WorkingHandler.dispatchMessage(HtcAmsCallbackManager.java:246)

W/ContextImpl( 503): at android.os.Looper.loop(Looper.java:158)

W/ContextImpl( 503): at android.os.HandlerThread.run(HandlerThread.java:60)

Have I missed something or is this a bug?
Thanks.

Hi ritschie,

Thank you for purchasing UTNotifications!

A thing with both Android push notifications services is that they don’t specify a standard message format because messages are handled not by the operating system but by the client code (in our case by UTNotifications). So the message format should match the format expected by UTNotifications. It requires at least two string fields: “title” and “text”. Please also note that in order to support non-English Unicode characters the both fields’ values should be URL-Encoded.

You can find a reference code for pushing notifications for UTNotifications at Assets/UTNotifications/DemoServer/src/DemoServer/PushNotificator.java.

Best regards,
Yuriy, Universal Tools team.

Thank you, this directed me to the problem, which is the message format generated by node-gcm

node-gcm sends:

“notification”: {*** },
“registration_ids”: [****]

and puts all message content in the notification node.
so I had to add the data node.

For everyone else, facing this:
Simply add
body.data = body.notification;
in line 41 of /node-gcm/lib/sender.js (before var requestBody = JSON.stringify(body); )
This copies the notification node in a new data node, which is required by UTNotificiations.

Thank you again, this saved me a lot of time.

1 Like

Hi Yuriy Ivanov
thanks for the cool Plug In
i just downloaded and need some help please…
and using this script
void Start () {
UTNotifications.Manager.Instance.SetNotificationsEnabled (false);
}
void OnApplicationPause () {
UTNotifications.Manager.Instance.SetNotificationsEnabled (true);
UTNotifications.Manager.Instance.ScheduleNotification(150,“Hello”,“Come on Play”,1,null,“first_not”);
UTNotifications.Manager.Instance.ScheduleNotification(10,“Hello2”,“Come on Play 2”,2,null,“first_not”);

}
and i have tow questions…
first is that the notification does come after 10 seconds and if i close the app it doesn’t open the app
and if i leave it in background it resume the app my question i why it doesn’t open the app after i close it ??
the second one is that i turn on the check box on edit>project settings>UTNotifications>Restore notifications on Reboot
but the second message doesn’t appear to come and the app is closed although it did gave me a permission that says “Run at start-up”
i really appreciate it if you can solve my problems…

Hi amer_na,

Thank you for using UTNotifications!

Before continuing answering your questions, I see that you don’t Initialize UTNotifications. Have you just skipped it in the sample code above or did you really forget to call it? A call of UTNotifications.Manager.Instance.Initialize is mandatory. Some basic functional will be available even without it, but most of the features require it.

  • Advice: you don’t have to use SetNotificationsEnabled(false) / SetNotificationsEnabled(true) in this case: there is a special option in the UTNotifications settings (Edit → Project Settings → UTNotifications → Common Android Settings → Show Notifications). You can just choose WHEN_CLOSED_OR_IN_BACKGROUND there.

1. first is that the notification does come after 10 seconds and if i close the app it doesn’t open the app and if i leave it in background it resume the app my question i why it doesn’t open the app after i close it ??
Notifications of any kind don’t (and shouldn’t) run the application automatically, they are just shown. The application will be started when user clicks on a notification, not before that. This is by design. That’s how notifications should work.
If I get your question wrong and you mean that notifications don’t appear after the application is killed in Android, then it is also simple. The reason is that OnApplicationPause is not called when you kill an application in Android, so UTNotifications stays disabled.

Also, you use ScheduleNotification and not ScheduleNotificationRepeating so each notification will be shown just once. If it was already shown, then after closing or hiding the application you will not receive any new notifications.

  1. the second one is that i turn on the check box on edit>project settings>UTNotifications>Restore notifications on Reboot but the second message doesn’t appear to come and the app is closed although it did gave me a permission that says “Run at start-up”
    The reason is too little triggerInSeconds value: 10 seconds. When you reboot an Android device it happens not instantly but takes some time. The problem is that notifications can still happen while a reboot is in progress but you will not see anything already. As you scheduled the notifications without repeating it happens just once (when rebooting) and will not be shown again after the reboot.

Best regards,
Yuriy, Universal Tools team.

Google added support for sending notifications to iOS through their GCM service. However, this seems to require that the iOS application register with both APNS and GCM. Does this plugin support that feature? We are looking to find a plugin that supports this mechanism, so that our server code only needs to send notifications through GCM and not interface with APNS directly.

For reference on this GCM feature: Firebase Cloud Messaging

Yuriy,

  1. Has UTNotifications been updated to reflect google’s changes in the last few months: Firebase Cloud Messaging ?

  2. How does UTNotfications handle IOS, does it use google cloud messaging to contact Apple Notification Server, or does it contact ANS separately, in a way not related to GCM?

Thanks!