Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

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

Discussion in 'Assets and Asset Store' started by Yuriy-Ivanov, Jun 12, 2015.

  1. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Hi @Woody4618 ,

    Try it with a blank test project, importing just UTNotifications there. Should work alright - most likely the issue is caused by other plugins for you (returning null is a usual thing, so no surprise there are issues with other plugins). If it's reproduced with only UTNotifications in the project, please let us know and describe the repro steps.

    Unfortunately Unity doesn't allow sharing a bug report ticket without also sharing all the other communication with their support from the same account, and it contains some of our private information. I'll let you know in case of any status updates. Its currently status is: Open.

    Best regards,
    Yuriy, Universal Tools team.
     
    Woody4618 likes this.
  2. Woody4618

    Woody4618

    Joined:
    Jul 1, 2015
    Posts:
    16
  3. MapMan

    MapMan

    Joined:
    Oct 27, 2013
    Posts:
    37
    @Yuriy-Ivanov Hello. I'm using UTNotifications and I'm having an issue when targeting iOS. Namely, after building my project in Unity and importing into XCode, the Push Notifications capability is enabled, even though push notifications in UTNotifications settings are disabled. I attached a debugger to Unity when building the XCode project and the iOSBuildPostProcessor correctly 'patches' the xcode project file, setting 'com.Apple.Push' to 0. Still, when I run XCode, the Push Notifications capability is enabled. When building locally, that is not an issue as I can just disable that capability and continue. When using Cloud Build, this prevents the build from succeeding.

    I'm unsure if this problem is related with UTN or not but hopefully you could have an idea what is wrong. Using UTN 1.7.1 and Unity 2018.2
     
  4. MapMan

    MapMan

    Joined:
    Oct 27, 2013
    Posts:
    37
    I updated UTN to latest version from asset store (seems to be 1.7.4 even though source files indicate 1.7.3 - probably forgot to update them, correct?). It seems you have removed the xcode project file patching that set the com.Apple.Push capability to 0 (when appropriate). What gives?
     
  5. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Hi @MapMan ,

    It's Unity 2018.2 that adds that capability to the project: since that version they started automatically adding that capability, see also https://github.com/universal-tools/UTNotificationsFeedback/issues/84 and https://answers.unity.com/questions/1528377/how-to-disable-push-notifications-capability-in-io.html. In 1.7.4 (you're right: it was an urgent hotfix for that issue and we forgot to update the internal version number constant, which doesn't really matter) we added a check to never patch the Xcode project capabilities to avoid conflicting with Unity's own patcher. I'm afraid I don't know a way to disable that patching in Unity: they don't seem to care really. There is a chance they automatically enable it if APNS related code is found in the project during the build (even disabled), but I'm not really sure about it. You might try contacting Unity with that question, as it's unfortunately seems to be totally out of our control at the moment. Please note, that 1.7.4 should work alright in the Cloud Build, although push notifications capability will be enabled, even though you're not using it (so Apple will warn you about it every time you upload a package to the AppStore).

    Honestly, I wouldn't update to Unity 2018.2 for production-ready projects yet - it's just too raw currently, even 2018.2.2f1 (I know at least 2 other pretty critical issues with it affecting Android builds).

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Aug 7, 2018
    Woody4618 likes this.
  6. MapMan

    MapMan

    Joined:
    Oct 27, 2013
    Posts:
    37
    @Yuriy-Ivanov Thank you for this insight.You confirmed my fears that Unity is at fault here.
     
  7. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Hi Yuriy, my app uses Firebase messaging for iOS and Android (APS and FCM, not ADM) ~and I’m using AWS SNS for device registration, topic creation, and topic subscription. I have AWS Lambda functions that send APS and FCM notifications based on data change events. This all works well, but I need ADM support. My use of Firebase messaging is minimal. I use it so I have a single codebase to get notifications on Apple and Android devices and I process the JSON messages myself. If I switched to UTNotifications, do I need the UT demo server or does it sound like my current server architecture would work as is? Thx
     
  8. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Hi @marcz88,

    Sure, your architecture is totally fine: SNS supports ADM (no surprise: they both belong to Amazon!), it's actually probably the most straightforward of all the platforms. See https://docs.aws.amazon.com/sns/latest/dg/mobile-push-adm.html for more details.

    Best regards,
    Yuriy, Universal Tools team.
     
  9. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Cool, I expected that I would have to configure ADM in AWS, and add some JSON for the ADM messages to my Lambda functions, but wasn't sure if UTNotifications relied only anything special in the Demo Server that I would need to move into my server architecture. If not, I'm going to buy a copy and start integrating. Thx.
     
  10. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    From looking at the asset files, it looks like UTNotifications relies on Google Play services on Android for FCM, but on Amazon Fire no need for Play services right?
     
  11. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    UTNotifications give you the complete client side: enabling push notifications, getting the registration id (which you then send to your SNS-enabled server - it replaces step 4 here), it handles the received ADM messages to display system notifications. The server side is up to you (or a 3rd party, like SNS). DemoServer is just a simple example how you can send push messages to any of the supported platforms, it's not something you'll be using in your server really.
     
  12. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Sure, there are no Google Play Services in Amazon, and it's not needed for UTNotifications to work in Amazon Kindle devices.
     
  13. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Perfect thx alot!
     
  14. dongliang28

    dongliang28

    Joined:
    Oct 3, 2010
    Posts:
    156
    Hi,i'm looking for a android plugin that can read other app's notifications.

    In your plugin's features i found a line "API for handling clicked & received notifications of any type both local and push."

    Does it means i found the right plugin i need or i am wrong?
     
  15. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Hi @dongliang28 ,

    No, you can't handle other apps' notifications (at least in non-rooted devices) for obvious security reasons.

    Best regards,
    Yuriy, Universal Tools team.
     
  16. dongliang28

    dongliang28

    Joined:
    Oct 3, 2010
    Posts:
    156
    Ok,thank you for reply.
     
  17. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Hi Yuriy,
    I've integrated UTNotifications, really nice asset, love how all three platforms (APNS, FCM and ADM) have single simple interface. One important question: my design before adding UTNotification relied on some user facing notifications and one silent app notification. The silent notification was one to tell my app that new data was available to be retrieved. I didn't want this to show up in the system tray so I was sending a data only payload with two internally used ids, no title or text. It looks like UTNotifications requires me to add the title and text nodes in my payload for these to be received. I get this if they are not there:

    08-21 10:30:35.741 6991-8715/? E/universal.tools.notifications.Manager: Push notification message is received but malformed: "data/title & "data/text not present!
    It can be just a service message, then you can ignore it. Otherwise configure Advanced->Push Payload Format in the UTNotifications settings


    After adding title and text to my payload, I'm now seeing these in the system tray if my apps is closed or in the background. Is there a way for UTNotifications to accept a payload without title and text nodes so I can silently tell my app to sync?
    Thx
     
    Last edited: Aug 21, 2018
  18. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    BTW, my notification server doesn't combine 'notification' and 'data' payloads. I use 'notification' to alert user when the app isn't visible, and 'data' to silently tell the app is needs to sync.

    My silent data payload looks this:
    Code (CSharp):
    1. var payload = {
    2.             default: 'new data available',
    3.             APNS_SANDBOX: { aps: { 'content-available': 1 },
    4.                             jpk: _jpk,
    5.                             jID: _jID },
    6.             GCM: { data: { jpk: _jpk,
    7.                            jID: _jID } },
    8.             ADM: { data: { jpk: _jpk,
    9.                            jID: _jID } }
    10.             };
    My user alert payload looks like this:
    Code (CSharp):
    1. var payload = {
    2.                 default: messageText,
    3.                 APNS: { aps: { alert: messageText, sound: 'ping', badge: badgeCount },
    4.                                 chID: challengeID },
    5.                 GCM: { notification: { body : messageText, title : titleText, sound: 'ping', badge: badgeCount },
    6.                         chID: challengeID }
    7.             };
    I haven't added ADM yet for this one.
     
    Last edited: Aug 21, 2018
  19. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Hi @marcz88 ,

    First, adding support for silent notifications in Android is very simple and straightforward: in the provided native plugin source code add a custom check before displaying any notification, if f.e. it is missing title and text, or contains some special user data of yours, just don't display it, the rest functionality will keep working fine.
    See
    Code (CSharp):
    1. private static void showNotification(Context context, final UTNotification notification, final Bitmap bitmap)
    in Assets/UTNotifications/Editor/Android/NativePluginSource/utnotifications/src/main/java/universal/tools/notifications/Manager.java.
    In case of missing title and text, please also update
    Code (CSharp):
    1. static void postPushNotification(Context context, final Bundle extras)
    in the same class, specifically remove/comment out the check:
    Code (CSharp):
    1. if (title == null && text == null) {
    2.     // Message format is invalid. It can be a service message from AppsFlyer or similar: ignore.
    3.     Log.e(Manager.class.getName(), "Push notification message is received but malformed: " +
    4.             "\"data/" + titleKey + " & " + "\"data/" + textKey + " not present!\nIt can be just a service message, then you can ignore it. Otherwise configure Advanced->Push Payload Format in the UTNotifications settings");
    5.     return;
    6. }
    You, of course, will have to build the plugin after that: see here for more details.
    In iOS, you should be able to use regular approach with sending "content-available" messages without any "alert" specified (although, I haven't tested it myself).

    Second, I'm afraid in order to make the entire functionality of UTNotifications work, you'll have to send data-only FCM messages. For more details please see the note of section Push Notifications Payload Format / FCM of the manual.

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Aug 21, 2018
    Woody4618 likes this.
  20. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Thx for the reply Yuriy and apologies for the delay. I actually had already started digging around in the NativePluginSource and found the places you referenced above (so it is as simple as you describe). I've got Apple and Android now working as expected. ADM is working for data only message, but for some reason I'm not seeing my user notifications. Could be a problem with the subscription to this topic on ADM.
    Thx again for your help.
    Marc
     
  21. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Could you please describe your issue with ADM better so I could help with it?
    What exactly is not working?
    1. Do you receive ADM registration id?
    2. What complete payload are you sending to ADM servers?
    3. It's only not displayed, or not even handled as a received notification?
    4. Is it possible that you add some logs to the native plugin, to see whether it tries to display the notification or not, and if not then which of the checks fails?

    Best regards,
    Yuriy, Universal Tools team.
     
  22. grogshotgames

    grogshotgames

    Joined:
    Aug 6, 2015
    Posts:
    68
    Hello!

    I'd lke to know... does this plugin support grouped/bundled notifications prior to 8.0 as described here?
     
  23. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Well... kinda. Although I don't recommend it, we'd like to deprecate that functionality in one of upcoming updates.

    The grouping capabilities in UTNotifications are really basic. They work that way:
    1. All notifications which you'd like to group get their group set. F.e., if you choose BY_NOTIFICATION_PROFILE option, the notification profile id will be used as the group name.
    2. When you have a few notifications of the same group displayed at the same time, you send a new "group summary" notification (but not before the original items are shown!). In UTNotifications it's done by adding a user data key "notification_group_summary" with any value (the value is ignored, you can use "1" for example). Please note that "summary" is in fact a regular notification, which looks like any other notification, it doesn't have a special group style.
    3. All the previously shown notifications are hidden, and the new one (the group summary) is shown instead.
    If there are multiple group summaries, they don't collapse into a single notification.

    It's most likely not something you expected, like a group notification shown in the article you've mentioned. You can of course update the native plugin any way you like to improve notification grouping as its source code is provided with the asset, but please don't forget to build/deploy it afterwards, as explained here: https://forum.unity.com/threads/rel...ications-and-more.333045/page-13#post-3533532.

    We have plans to improve the grouping functionality, but there is no due date for it yet I'm afraid.

    Best regards,
    Yuriy, Universal Tools team.
     
  24. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Hi Yuriy, I figured out the problem on ADM notifications. I had changed the default title and text tags trying to get silent data alerts before changing the plugin. And I forgot to change them back. All good now! Thank you for your help. I'm now supporting all three (iOS, GCM and ADM) from a single codebase. Very nice.
     
  25. grogshotgames

    grogshotgames

    Joined:
    Aug 6, 2015
    Posts:
    68
    Great,

    Thanks for letting me know. I guess we'll purchase it and implement the grouping feature it in the future when it's released.
     
  26. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    Hi Yuriy, on iOS I'm seeing a lot of messages in the console regarding looking for notifications. Is this coming from UTNotifications, is it normal? Thx

    default 13:30:38.322429 -0400 myapp [com.myco.myapp] Got 0 pending notification [ hasCompletionHandler: 1 ]
    default 13:30:38.322589 -0400 myapp [com.myco.myapp] Getting pending notification requests
    default 13:30:38.324151 -0400 SpringBoard [com.myco.myapp] Load 0 pending notification dictionaries
    default 13:30:38.324289 -0400 SpringBoard [com.myco.myapp] Load pending 0 notifications
    default 13:30:38.325855 -0400 myapp [com.myco.myapp] Got 0 pending notification [ hasCompletionHandler: 1 ]
    default 13:30:39.418645 -0400 myapp [com.myco.myapp] Getting pending notification requests
    default 13:30:39.420581 -0400 SpringBoard [com.myco.myapp] Load 0 pending notification dictionaries
    default 13:30:39.420688 -0400 SpringBoard [com.myco.myapp] Load pending 0 notifications
    default 13:30:39.422510 -0400 myapp [com.myco.myapp] Got 0 pending notification [ hasCompletionHandler: 1 ]
    default 13:30:39.422757 -0400 myapp [com.myco.myapp] Getting pending notification requests
    default 13:30:39.424310 -0400 SpringBoard [com.myco.myapp] Load 0 pending notification dictionaries
    default 13:30:39.424445 -0400 SpringBoard [com.myco.myapp] Load pending 0 notifications
    default 13:30:39.426087 -0400 myapp [com.myco.myapp] Got 0 pending notification [ hasCompletionHandler: 1 ]
    default 13:30:40.518854 -0400 myapp [com.myco.myapp] Getting pending notification requests
    default 13:30:40.520532 -0400 SpringBoard [com.myco.myapp] Load 0 pending notification dictionaries
    default 13:30:40.520671 -0400 SpringBoard [com.myco.myapp] Load pending 0 notifications
    default 13:30:40.522570 -0400 myapp [com.myco.myapp] Got 0 pending notification [ hasCompletionHandler: 1 ]
    default 13:30:40.522724 -0400 myapp [com.myco.myapp] Getting pending notification requests
    default 13:30:40.524247 -0400 SpringBoard [com.myco.myapp] Load 0 pending notification dictionaries
    default 13:30:40.524323 -0400 SpringBoard [com.myco.myapp] Load pending 0 notifications
    default 13:30:40.526147 -0400 myapp [com.myco.myapp] Got 0 pending notification [ hasCompletionHandler: 1 ]
    default 13:30:41.620113 -0400 myapp [com.myco.myapp] Getting pending notification requests
    default 13:30:41.622187 -0400 SpringBoard [com.myco.myapp] Load 0 pending notification dictionaries
    default 13:30:41.622353 -0400 SpringBoard [com.myco.myapp] Load pending 0 notifications
    default 13:30:41.624823 -0400 myapp [com.myco.myapp] Got 0 pending notification [ hasCompletionHandler: 1 ]
    default 13:30:41.625050 -0400 myapp [com.myco.myapp] Getting pending notification requests
    default 13:30:41.627126 -0400 SpringBoard [com.myco.myapp] Load 0 pending notification dictionaries
     
  27. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Hi @marcz88 ,

    No, these are not UTNotifications messages. I'm honestly not sure what produces these log records, it can be specific Android build or another library in your project, but that's not us.

    Best regards,
    Yuriy, Universal Tools team.
     
  28. marcz88

    marcz88

    Joined:
    Mar 12, 2017
    Posts:
    41
    This is on iOS, in the Console app when I select system log.
     
  29. igortest16

    igortest16

    Joined:
    Feb 3, 2017
    Posts:
    2
    Hi, @Yuriy-Ivanov. We have an issue with tinting android5+ white-transparent notification icon on at least two Samsung devices (Galaxy S7 on Android 8.0 and Galaxy J5 on Android 7.1.1). On other android5+ devices the icon is tinted correctly. Can you advice how to workaround this issue? We use UTNotifications 1.7.1 on Unity 2017.3.1. Screenshot_20180821-131820_.jpg
     
  30. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Hi @marcz88 ,

    Ah I see. That's probably logged when building with debug enabled or it can be a 3rd party asset or your own code, I'm not sure, but it's not anything in UTNotifications. Just ignore these messages.

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Sep 1, 2018
  31. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    HI @igortest16 ,

    Is there a chance that you picked white as color in UTNotifications profile settings? By default, when no color is chosen, the small notification icon should be automatically turned into a contrast color (like it happened with other notifications in your screenshot).

    If not, could you please send me the white-transparent icon you're using so I'll try to reproduce your issue and then find a solution for it? Please also tell me what version of Android you're targetting in the Android build settings in Unity or AndroidManifest.xml.

    Btw, I speak Russian, if you prefer it.

    Best regards,
    Yuriy, Universal Tools team.
     
  32. igortest16

    igortest16

    Joined:
    Feb 3, 2017
    Posts:
    2
    No, the checkbox "Small Icon BG (Android 5-7)" is not checked. And on other devices (at least Huawei P20 lite, Xiaomi 4X) the icon is NOT white (it is tinted as expected).

    We target on SDK version 28.
    Find original icon, decompiled effective AndroidManifest, and apk file itself on this file exchange:
    https://dropmefiles.com/GRoMs
     
  33. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Hi @igortest16 ,

    Unfortunately we don't have either of the devices you have issues with, so I can't really check it, but your AndroidManifest.xml is missing uses-sdk element. I understand you define min/target values in the Android build settings in Unity, but for some reason they don't seem to be coming into the manifest. I'm not sure though if it can be causing the issue (f.e. Samsung builds of Android could interpret this case not the same way as the other devices) or not, so you can just check it by manually defining such an element in Assets/Plugins/Android/AndroidManifest.xml. Your icon looks totally sane.
    Please let me know if it helps or not.

    Best regards,
    Yuriy, Universal Tools team.
     
  34. hacanalic

    hacanalic

    Joined:
    Jul 7, 2018
    Posts:
    1
    Hi @Yuriy-Ivanov ,

    I am using UTNotification in two of my games, and it works great. I was using targetSdkVersion 25 and it works perfectly but we changed targetSdkVersion to any version above 25 it started crashing on receiving push notification on android devices on OS 8 and above [GCMBroadcastReceiver].

    After reading forum I found it is resolved in latest version and after downloading I realized it moved to Firebase which is a huge change for me, I will move to it eventually but not right now.

    Is there anyway I can resolve that issue without shifting to Firebase?
    How can I see which UTNotification version I am using?
     
  35. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Hi @hacanalic ,

    I'm afraid you'll have to migrate to FCM. Let me just quote the manual:

    Migrating from GCM to FCM
    Google doesn’t allow enabling GCM in new apps anymore and will once stop to service existing ones, so migrating from GCM to FCM is what you’ll have to do anyway. But here are good news: Google updated their GCM servers so they can now send messages to both GCM and FCM using the same old GCM API and even the same URL https://android.googleapis.com/gcm/send. It means that you’ll not have to modify your server code, and also any 3rd party services supporting GCM automatically support FCM. You’ll probably have to distinguish server instances/3rd party services app accounts between GCM and FCM versions of your app, as FCM version will have different server keys. There is no reason to not migrate to FCM. Please refer to the section Configuring the Firebase Cloud Messaging (FCM) to find out how.


    Here is also a quote from an email Google sent to GCM customers some time ago:

    In order to devote more time and attention to improving FCM, today we’re announcing that you must upgrade to FCM in the next year. The GCM server and client APIs are deprecated and will be removed as soon as April 11, 2019. We recommend you upgrade sooner rather than later so you can start taking advantage of the new features in FCM today.
    If you have projects that are still using the GCM APIs, you will need to update your client and server code to use FCM before April 11, 2019. Your existing GCM tokens will continue to work with FCM so you won’t lose the ability to send to your existing users.


    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Sep 20, 2018
  36. novydhillon

    novydhillon

    Joined:
    Jan 9, 2018
    Posts:
    2
    Hi @Yuriy-Ivanov

    Does UTNotifications support FCM notifications when the app is backgrounded or inactive?

    Thanks
     
  37. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Yes, normally notifications are shown well even if the app is closed. But it depends on how exactly you exit the app: regular closing with Application.Quit() or swiping away in the recent applications list is fine, but force-stopping the app in Android (in applications settings) stops also any background services of the app, including notifications. Please note that some Android devices (mostly cheap models with small battery capacity) force-stop any closed applications except of white-listed applications like popular messengers. Some power-saver Android applications do the same.

    Of course, notifications are received well and shown well when the app is running in background.

    Best regards,
    Yuriy, Universal Tools team.
     
  38. outthinking01

    outthinking01

    Joined:
    Sep 22, 2014
    Posts:
    1
    Hi @Yuriy-Ivanov

    Does the scheduled notification will work if we change device date/time in android.
    Example: Suppose i scheduled a local notification for next 1 hour time, than i will change device time & increase it by 1 hour, then immediately that scheduled notification will trigger or how it behaves?
    In my case scheduled notifications not working if i change device date/time..
     
  39. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Hi @outthinking01 ,

    We're using AlarmManager.ELAPSED_REALTIME timer, which ignores changing date/time: it's done on purpose to avoid users' cheating with system time to get in-game advantages. Feel free to change the timer type in 2 places in
    Code (CSharp):
    1. static void scheduleNotificationCommon(Context context, final UTNotification notification)
    (Assets/UTNotifications/Editor/Android/NativePluginSource/utnotifications/src/main/java/universal/tools/notifications/Manager.java)
    to whatever you prefer. Please note:
    1. Other timer types accept time in different formats, so you might also have to update triggerAtSystemTimeMillisToElapsedRealtime.
    2. You'll have to rebuild the native plugin to apply the changes. Please see here for more details.

    Best regards,
    Yuriy, Universal Tools team.
     
  40. unity_bz4Y8hzorkKnDQ

    unity_bz4Y8hzorkKnDQ

    Joined:
    Jul 25, 2018
    Posts:
    3
    Hi @Yuriy-Ivanov, i have updated plugin and now pushes on android doesnt work. i debuged it with logcat and got the error:
    10-03 12:11:36.580: E/universal.tools.notifications.Manager(24443): java.lang.NoSuchMethodError: No static method applyNotification(Landroid/content/Context;Landroid/app/Notification;I)V in class Lme/leolin/shortcutbadger/ShortcutBadger; or its super classes (declaration of 'me.leolin.shortcutbadger.ShortcutBadger' appears in /data/app/vegas.panther.spv-2/base.apk:classes23.dex)
    10-03 12:11:36.590: W/System.err(24443): java.lang.NoSuchMethodError: No static method applyNotification(Landroid/content/Context;Landroid/app/Notification;I)V in class Lme/leolin/shortcutbadger/ShortcutBadger; or its super classes (declaration of 'me.leolin.shortcutbadger.ShortcutBadger' appears in /data/app/vegas.panther.spv-2/base.apk:classes23.dex)
    10-03 12:11:36.590: W/System.err(24443): at universal.tools.notifications.Manager.showNotification(Manager.java:609)
    10-03 12:11:36.590: W/System.err(24443): at universal.tools.notifications.Manager.postNotification(Manager.java:465)
    10-03 12:11:36.590: W/System.err(24443): at universal.tools.notifications.AlarmBroadcastReceiver.onReceive(AlarmBroadcastReceiver.java:16)
    10-03 12:11:36.590: W/System.err(24443): at android.app.ActivityThread.handleReceiver(ActivityThread.java:3700)
    10-03 12:11:36.590: W/System.err(24443): at android.app.ActivityThread.access$2000(ActivityThread.java:229)
    10-03 12:11:36.590: W/System.err(24443): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1903)
    10-03 12:11:36.590: W/System.err(24443): at android.os.Handler.dispatchMessage(Handler.java:102)
    10-03 12:11:36.590: W/System.err(24443): at android.os.Looper.loop(Looper.java:148)
    10-03 12:11:36.590: W/System.err(24443): at android.app.ActivityThread.main(ActivityThread.java:7406)
    10-03 12:11:36.590: W/System.err(24443): at java.lang.reflect.Method.invoke(Native Method)
    10-03 12:11:36.590: W/System.err(24443): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    10-03 12:11:36.590: W/System.err(24443): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)


    Can you help me?
     
  41. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Hi @unity_bz4Y8hzorkKnDQ,

    It seems you're missing one of the libraries UTNotifications depends on, specifically ShortcutBadger, or you got wrong version of it. It might happen if UTNotifications 1.7.4 was imported not completely. I'd suggest you to check your Assets/Plugins/Android folder. If there are any ShortcutBadger-*.aar files, delete them and then import the asset again to get the required version of this library added.

    Best regards,
    Yuriy, Universal Tools team.
     
  42. unity_bz4Y8hzorkKnDQ

    unity_bz4Y8hzorkKnDQ

    Joined:
    Jul 25, 2018
    Posts:
    3
    Ty. it works, but on some androids i see on pushes not icon that i assigned in nottification settings
     
  43. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    There can be a few reasons of that behavior.
    1. (most likely) you send a payload containing "notification" node. Please see notes of section Push Notifications Payload Format/FCM of the manual.
    2. It might be Android 4.x/5+ difference issue: please see section Using Notification Profiles (Sounds, Icons and Other Attributes) of the manual, specifically its last paragraph.
    Best regards,
    Yuriy, Universal Tools team.
     
  44. plasmiceuphoria

    plasmiceuphoria

    Joined:
    Oct 9, 2011
    Posts:
    3
    Hi Yuriy,

    Are there plans to add support for Android's BigPictureStyle, and iOS's Rich Notifications?

    Regards,
    Patrick
     
  45. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Hi @plasmiceuphoria ,
    1. BigPictureStyle is supported already. See section "Image Notifications (Android)" of the manual.
    2. Currently there are no plans for iOS Rich Notifications: in order to avoid conflicts with Unity's own generated application code we're using its NotificationServices API in iOS, which unfortunately doesn't support Rich Notifications.
    Best regards,
    Yuriy, Universal Tools team.
     
  46. HayucoDev

    HayucoDev

    Joined:
    Oct 10, 2018
    Posts:
    2
    Hi Yuriy!!! I am newbie in Unity and have a problem with UTNotifications. Only when I build the IOS project. Works without errors in editor, works perfect on android.
    This is log console:
    Assets/UTNotifications/Src/iOS/IOSBuildPostprocessor.cs(9,19): error CS0234: The type or namespace name `iOS' does not exist in the namespace `UnityEditor'. Are you missing an assembly reference?
    Assets/UTNotifications/Src/iOS/IOSBuildPostprocessor.cs(9,19): error CS0234: The type or namespace name `iOS' does not exist in the namespace `UnityEditor'. Are you missing an assembly reference?
    I read a lot of information about this issue but could not fixed. I updated Unity and UTN too.
    Im using Unity 2018.2.11f1, UTNotifications 1.7.3, xcode 8.3.3 in MacOs Sierra VM.
    Thanks!!!
     
  47. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    344
    Hi @HayucoDev,

    It's most likely caused by a failure of Unity to move the file to its new location when updating the asset. The new location of that file is Assets/UTNotifications/Src/iOS/Editor/IOSBuildPostprocessor.cs, which makes it compile and executed only in Unity Editor. So either delete that file altogether (and its .meta file as well) and then reimport the asset, or just manually create a folder Editor in Assets/UTNotifications/Src/iOS/ and move IOSBuildPostprocessor.cs there manually. The issue should be gone then.

    Best regards,
    Yuriy, Universal Tools team.
     
  48. HayucoDev

    HayucoDev

    Joined:
    Oct 10, 2018
    Posts:
    2
    Thanks so much Yuriy!!!!
     
  49. Ilya-TH

    Ilya-TH

    Joined:
    May 9, 2018
    Posts:
    1
    Hi @Yuriy-Ivanov,

    I'm doing the GCM->FCM migration for our project and already installed the FCM plugin, but got stuck on the "data" notifications we are getting and that's where your plugin will get handy. So I'm currently integrating it and was wondering:
    - should I remove the Firebase plugin integration and let the UTN handle things? UPD: Yes;
    - why are you using the GCM library and service in the AndroidManifest, while it's recommended to remove it (part 3):
    https://developers.google.com/cloud-messaging/android/android-migrate-fcm.

    My concern is, won't there be any difficulties when the Google shuts down the GCM completely?
     
    Last edited: Oct 12, 2018
  50. unity_bz4Y8hzorkKnDQ

    unity_bz4Y8hzorkKnDQ

    Joined:
    Jul 25, 2018
    Posts:
    3
    here is code i use for caling notification
    Code (CSharp):
    1.             public void AddHourlyBonus(double seconds, bool required = true)
    2.         {
    3.             var now = DateTime.Now.AddSeconds(seconds);
    4.             AddNotifications(HourlyBonus, now, null, LocalNotification.HourlyBonus);
    5.             Debug.LogError("ADD COINS BONUS , SECONDS = " + seconds);
    6.         }
    7.  
    8. public void AddHourlyBonusMissed(double seconds = 0)
    9.         {
    10.             if (seconds <= 0)
    11.             {
    12.                 seconds = 3;
    13.             }
    14.             var args = new Dictionary<string, string> { { "notification", LocalNotification.HourlyBonusMissed } };
    15.             AddNotifications(HourlyBonusMissed, DateTime.Now.AddSeconds(seconds),
    16.                 args, LocalNotification.HourlyBonusMissed);
    17.         }
    18.  
    19.         private void AddNotifications(LocalNotificationInfo notification, DateTime time,
    20.             Dictionary<string, string> userData, string type)
    21.         {
    22.             Manager.Instance.ScheduleNotification(time, notification.Title, notification.Message, notification.Id,
    23.                 userData, type, 1);
    24.         }
    in any case one i see old icon on pushes that i assigned, only on androids and only on some that have android version 6+