Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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:
    495
    Hi @neowedge ,

    You can achieve it by modifying the provided native plugin source code. Open the native plugin source code in Android Studio, edit it and then build & deploy, as explained here: https://forum.unity.com/threads/rel...ications-and-more.333045/page-13#post-3533532.

    In UTNotifications native plugin, see Assets/UTNotifications/Editor/Android/NativePluginSource/utnotifications/src/main/java/universal/tools/notifications/Manager.java:

    Code (CSharp):
    1.         if (bitmap != null) {
    2.                 builder.setStyle(new Notification.BigPictureStyle().bigPicture(bitmap).setBigContentTitle(title).setSummaryText(text));
    3.         } else {
    4.                 builder.setStyle(new Notification.BigTextStyle().bigText(text));
    5.         }
    6.  
    So in your case, instead of setting any style here, you'll do setCustomBigContentView.

    See also https://developer.android.com/train...ion#create_a_fully_custom_notification_layout.

    I also recommend you to make sure to read the caution messages in that article:
    Best regards,
    Yuriy, Universal Tools team.
     
  2. MiguelGameDev

    MiguelGameDev

    Joined:
    May 6, 2014
    Posts:
    10
    Thanks! ;)
     
  3. mvaz_p

    mvaz_p

    Joined:
    Aug 22, 2018
    Posts:
    80
    Hi, I'm having the same issues as @outthinking01

    When I try to schedule a notification that includes emojis it gives me the following error (Native Crash on Android 5.0), where is written "EMOJI" is the actual emoji character (U+1F4E6):

    Code (Logcat):
    1.  sart/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal start byte 0xf0
    2. sart/runtime/check_jni.cc:65]     string: '[ {"title":"title! EMOJI", "text":"body! EMOJI", "id":"0", "userData":
    3. {"notificationType":"Test"}, "badgeNumber":"1", "triggerDateTime":"10/01/2019 10:52:50"} ]'
    4. sart/runtime/check_jni.cc:65]     in call to NewStringUTF
    5. sart/runtime/check_jni.cc:65]     from boolean com.unity3d.player.UnityPlayer.nativeRender()
    6. sart/runtime/check_jni.cc:65] "UnityMain" prio=5 tid=40 Runnable
    And when I try to restart the application:
    Exception: JSON Parse: Quotation marks seems to be messed up.


    This seems to be related to saving non-Modified UTF8 strings in PlayerPrefs, and happens at least on Android 5.0 and 4.4.
    Any suggestions on how to proceed? Thanks.
     
  4. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @mvaz_p,

    May I find out what version of Unity you're at? As this is a Unity bug which has been fixed in 2019.2: see https://unity3d.com/unity/whats-new/2019.2.0
    Best regards,
    Yuriy, Universal Tools team.
     
  5. mvaz_p

    mvaz_p

    Joined:
    Aug 22, 2018
    Posts:
    80
    Hello, @Yuriy-Ivanov, I'm currently using 2019.1.14, but I've just tried updating to 2019.2.6 and the problem persists. Here are the related logs:

    sart/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal start byte 0xf0



    10-02 02:32:46.865 E/CRASH ( 5687): #30 pc 00012f70 /system/lib/libc.so (abort+4)
    10-02 02:32:46.865 E/CRASH ( 5687): #31 pc 00012f70 /system/lib/libc.so (abort+4)
    10-02 02:32:46.865 E/CRASH ( 5687): #32 il 0000003b at (wrapper managed-to-native) UnityEngine.PlayerPrefs.TrySetSetString (string,string) <0x0003b>
    10-02 02:32:46.865 E/CRASH ( 5687): #33 il 0000001b at UnityEngine.PlayerPrefs.SetString (string,string) [0x00003] in /Users/builduser/buildslave/unity/build/Runtime/Export/PlayerPrefs/PlayerPrefs.bindings.cs:49
    10-02 02:32:46.865 E/CRASH ( 5687): #34 il 00000147 at UTNotifications.Manager.SaveScheduledNotifications () [0x00062] in /Users/mvaz/Workspace/idlerocket/Assets/UTNotifications/Src/Manager.cs:672
    10-02 02:32:46.865 E/CRASH ( 5687): #35 il 00000043 at UTNotifications.Manager.RegisterScheduledNotification (UTNotifications.ScheduledNotification) [0x00022] in /Users/mvaz/Workspace/idlerocket/Assets/UTNotifications/Src/Manager.cs:637
    10-02 02:32:46.865 E/CRASH ( 5687): #36 il 000000bb at UTNotifications.Manager.ScheduleNotification (UTNotifications.ScheduledNotification) [0x00038] in /Users/mvaz/Workspace/idlerocket/Assets/UTNotifications/Src/Manager.cs:243
    10-02 02:32:46.865 E/CRASH ( 5687): #37 il 000000d7 at UTNotifications.Manager.ScheduleNotification (System.DateTime,string,string,int,System.Collections.Generic.IDictionary`2<string, string>,string,int,System.Collections.Generic.ICollection`1<UTNotifications.Button>) [0x00013] in /Users/mvaz/Workspace/idlerocket/Assets/UTNotifications/Src/Manager.cs:213
    10-02 02:32:46.865 E/CRASH ( 5687): #38 il 000000bf at UTNotifications.Manager.ScheduleNotification (int,string,string,int,System.Collections.Generic.IDictionary`2<string, string>,string,int,System.Collections.Generic.ICollection`1<UTNotifications.Button>) [0x00013] in /Users/mvaz/Workspace/idlerocket/Assets/UTNotifications/Src/Manager.cs:185
     
  6. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @mvaz_p,

    Thank you for all the details, it definitely helps. We'll research why it's happening and suggest the best possible way to fix it. I'll let you know then.

    Best regards,
    Yuriy, Universal Tools team.
     
  7. cabanel

    cabanel

    Joined:
    Sep 22, 2014
    Posts:
    66
    Ciao,

    potresti elencare le differenze tra
    UTNotifications
    e
    Unity Mobile Notification Package?

    per quanto riguarda le notifiche locali (non push)

    Grazie
     
  8. SimonDeathcore

    SimonDeathcore

    Joined:
    Dec 7, 2018
    Posts:
    3
    @Yuriy-Ivanov, здравствуйте! хочу в проекте заменить звук уведомлений на android и ios, по документации понял, что нужно создать профиль, но как сделать его доступным в коде, видит только default. Я еще новичок, может что то упустил, если нужно где то еще прописать путь, в каком именно файле? то что в документации не находит. Может есть инструкция более подробная, где что искать? Спасибо!
     
  9. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    I can confirm the issue, it's a Unity bug. I reported the bug to them. Meanwhile I suggest you the following workaround:
    replace line Assets/UTNotifications/Src/Manager.cs:672 with
    Code (CSharp):
    1. PlayerPrefs.SetString(SCHEDULED_NOTIFICATIONS_PREFS_KEY, UnityEngine.Networking.UnityWebRequest.EscapeURL(json.ToString()));
    and line Assets/UTNotifications/Src/Manager.cs:679 with
    Code (CSharp):
    1. String jsonString = UnityEngine.Networking.UnityWebRequest.UnEscapeURL(PlayerPrefs.GetString(SCHEDULED_NOTIFICATIONS_PREFS_KEY));
    I hope it helps.

    Best regards,
    Yuriy, Universal Tools team.
     
    mvaz_p likes this.
  10. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Ciao @cabanel,
    Le differenze più importanti includono:
    - A differenza del pacchetto di Unity, UTNotifications fornisce API multipiattaforma, ovvero scrivi codice una volta e funziona sia su Android, iOS che UWP.
    - La funzione NotificationProfiles consente di configurare facilmente suoni / icone personalizzati e altre impostazioni per le notifiche.
    - Consente di gestire le notifiche cliccate e le notifiche che sono state ricevute mentre l'app non era in esecuzione.
    - Molto più flessibile e offre una serie di altre funzionalità (notifiche di immagini Android e altro).

    Best regards,
    Yuriy, Universal Tools team.
     
  11. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Здравствуйте @SimonDeathcore,

    Имя профиля уведомлений указывается как опционный аргумент в каждой из функций для планирования или показа локальных уведомлений, см. например http://universal-tools.github.io/UT...anager.html#a2d429e93e779204b019628792f9fd321, строковой аргумент notificationProfile.

    Вы также можете указать имя профиля при отправке пуш-уведомлений с вашего сервера. Как именно - показано в секции Using Notification Profiles (Sounds, Icons and Other Attributes) нашего официального манула.

    Best regards,
    Yuriy, Universal Tools team.
     
  12. SimonDeathcore

    SimonDeathcore

    Joined:
    Dec 7, 2018
    Posts:
    3
    @Yuriy-Ivanov, все так и делали, но проблема в том что новый профиль в аргумент прописать нельзя, видит только default. Или просто создав его в UTNotificationsSettings, недостаточно?
     
  13. essoperagma

    essoperagma

    Joined:
    Dec 1, 2016
    Posts:
    6
    Hi,
    In my app, I wasn't getting push notifications on android. It was working fine on iOS.
    I have Firebase Messaging imported into the project, but I'm not using it yet.
    I created a sample project and imported the plugin (1.8.2). Push notifications were working. So I checked manifest files of both APKs. In my project, 3 services were specifying MESSAGING_EVENT whereas only 2 services in the sample project.

    pn.png

    I guess messages were caught by "com.google.firebase.messaging.cpp.ListenerService" before "universal.tools.notifications.FCMService", so notifications were never displayed. I added following lines to my manifest file to get rid of that listener as explained in firebase documentation:

    Code (CSharp):
    1. <service android:name="com.google.firebase.messaging.cpp.ListenerService"
    2.          tools:node="remove" />
    3.  
    Now push notifications are working. I am not sure if I broke anything in the process. I'm here to get feedback and also to ask: shouldn't this piece of xml be placed in our manifest file automatically by the plugin? Or is there a better way of doing this?
     
  14. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Не понял, в каком смысле нельзя? Это строковой аргумент, что хотите то и пишете туда.
    Например,

    Code (CSharp):
    1. UTNotifications.Manager.Instance.ScheduleNotification(30, "Fancy Notification", "Fancy some notification? Click here then!", 10, null, "my_super_awesome_notification_profile");
    Best regards,
    Yuriy, Universal Tools team.
     
  15. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @essoperagma,

    It's expected that you either use UTNotifications or Firebase Messaging SDK in your project in order to deal with FCM, not both. If you prefer Firebase SDK to handle FCM instead of UTNotifications, please make sure to disable the appropriate toggle in UTNotifications settings, but in that case you won't be able use UTNotifications' push functionality in Android/FCM, only Firebase SDK API.

    UTNotifications does automatically configure the manifest, but only for its own functionality. We don't manage 3rd party libraries and their configurations.

    Best regards,
    Yuriy, Universal Tools team.
     
    essoperagma likes this.
  16. mvaz_p

    mvaz_p

    Joined:
    Aug 22, 2018
    Posts:
    80
    Hi @Yuriy-Ivanov, thanks for the previous previous answer!
    Just want to let you know that we've had another issue.
    The serialization of "triggerDateTime" in "ScheduledNotification" is not using invariant culture. It happened that on some of ours iOS devices, the format that was serialized was different from the one that was being used to deserialize, which threw an Exception.

    Here's my fix, hope it helps.

    Code (CSharp):
    1.         /// <summary>
    2.         /// Initializes a new instance of the <see cref="T:UTNotifications.ScheduledNotification"/> class.
    3.         /// </summary>
    4.         /// <param name="json">Notification json.</param>
    5.         public ScheduledNotification(JSONNode json)
    6.             : base(json)
    7.         {
    8.             this.triggerDateTime = !(json["triggerDateTime"] is JSONLazyCreator) ? DateTime.Parse(json["triggerDateTime"].Value, CultureInfo.InvariantCulture) : TimeUtils.UnixTimestampMillisToDateTime(double.Parse(json["triggerAtSystemTimeMillis"].Value));
    9.         }
    10.  
    11.         /// <summary>
    12.         /// Converts to a notification json.
    13.         /// </summary>
    14.         /// <returns>The json.</returns>
    15.         public override JSONClass ToJson()
    16.         {
    17.             JSONClass json = base.ToJson();
    18.  
    19.             json.Add("triggerDateTime", new JSONData(this.triggerDateTime.ToString(CultureInfo.InvariantCulture)));
    20.  
    21.             return json;
    22.         }
     
    Ivanisov_Vitaliy likes this.
  17. SimonDeathcore

    SimonDeathcore

    Joined:
    Dec 7, 2018
    Posts:
    3
    @Yuriy-Ivanov, немного не так писал, спасибо. Но проблема в том что на ios звук так и не поменялся, только на андроид. Формат wav, может в этом проблема? по документации, вроде как ничего дополнительно настраивать не нужно, только создать профиль и вызвать. Или я не прав?
     
  18. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @mvaz_p,

    Thank you a lot, do you know a way to reproduce it? Does it happen when you change system locale between the application runs or somehow else? We'll be glad to include the fix to the next update, but of course we'd like to test it properly, and for this it's important to know a way to reproduce that issue.

    Best regards,
    Yuriy, Universal Tools team.
     
  19. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    На iOS есть ограничения на конкретное кодирование аудиофайла и его длительность. См. https://developer.apple.com/documen...ns/unnotificationsound?language=objc#overview

    Скажите, пожалуйста, если это вдруг не помогло. В таком случае было бы здорово узнать конкретные шаги для воспроизведения проблемы, а лучше всего получить небольшой юнити-проект, в котором со звуком уведомления проблемы, будем тогда разбираться.

    Best regards,
    Yuriy, Universal Tools team.
     
  20. mvaz_p

    mvaz_p

    Joined:
    Aug 22, 2018
    Posts:
    80
    Hi @Yuriy-Ivanov, I only tried to schedule a notification and reopen the game, then it threw an exception. Didn't change the system locale.
    It was an iPhone SE with pt-br locale.
     
  21. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Thanks a lot! We'll take a look at it as a priority.
     
  22. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    We were able to reproduce that issue, but surprisingly only when changing the system locale between the app runs. Using the same Portuguese locale enabled wasn't enough, while changing the locale dynamically caused the issue indeed. It's fixed now and will be released with a couple other changes soon.

    Best regards,
    Yuriy, Universal Tools team.
     
    mvaz_p likes this.
  23. AkhmedAbasov

    AkhmedAbasov

    Joined:
    Mar 13, 2014
    Posts:
    163
    1. Is it possible to schedule notifications say for 3-4 days? I know how to do a repetition, but it turns out endless.
    2. Is it possible, when clicking on a notification, to receive information about all accumulated notifications?
     
  24. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @Laguna_Seca,

    1. Is it possible to schedule notifications say for 3-4 days? I know how to do a repetition, but it turns out endless.
    You can always schedule several non-repeating notifications with the same title/text if you like, just make sure to use different ids for them so they won't replace one another.

    2. Is it possible, when clicking on a notification, to receive information about all accumulated notifications?
    Not sure I understand what you mean. You can get a list of all currently scheduled notifications: http://universal-tools.github.io/UT...anager.html#aa33897ab91f9858a6c2b2f54b7aefb70 and also you can handle any received notifications: http://universal-tools.github.io/UT...anager.html#aff9bd679b8602eded21c9624469dd17a.

    Best regards,
    Yuriy, Universal Tools team.
     
  25. unitexer

    unitexer

    Joined:
    Apr 18, 2019
    Posts:
    8
    Hi @Yuriy-Ivanov

    I use UTNotification, a great asset, thank you. I've faced with some strange behavior on iOs. I have a simple code:

    Code (CSharp):
    1. var notificationsManager = Manager.Instance;
    2.  
    3. notificationsManager.OnNotificationClicked += (notification) =>
    4. {
    5.     Debug.Log($"Notification {notification.id} clicked");
    6. };
    7.        
    8. notificationsManager.Initialize(true);
    9. notificationsManager.CancelAllNotifications();
    It works well on Android, I can see "Notification <number> clicked" when I open the application by clicking on the local notification.

    On iOs builds built on some machines local notification clicks are not tracked. I've tried to compare xcode projects in which the click works and doesn't work, but found no significant differences.

    Could you please clarify what to look for, which part of the project is responsible for tracking the local notification click?

    UPD

    Seems like I got it. Looks like postprocessor does not modify UnityAppController.mm
     
    Last edited: Oct 16, 2019
  26. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @unitexer,

    1. It can't work unless you delay
    Code (CSharp):
    1. notificationsManager.CancelAllNotifications();
    for one frame (f.e. using a coroutine) - iOS clicked notifications are known on the next frame after initializing the Manager, and cancelling all immediately after initialization makes it impossible.
    2.
    It can happen if you have Firebase Cloud Messaging Unity SDK in your project. Unfortunately Google broke built-in Unity functionality we rely on in their SDK. I don't know a good solution for it (except of ditching Firebase SDK altogether until they sort it with Unity - the way they do it now is really dangerous and vicious). UTNotifications' push notifications functionality in many cases replaces Firebase SDK FCM stuff well.
    If it's not your case, I'll need more details to find out why the patching fails in your case.

    Best regards,
    Yuriy, Universal Tools team.
     
  27. unitexer

    unitexer

    Joined:
    Apr 18, 2019
    Posts:
    8
    Hi @Yuriy-Ivanov

    Its strange, but it works even without coroutine. Neither the less I updated my code accordingly, thanks for advice

    I found that postprocessor code inside platform dependent compilation directive
    Code (CSharp):
    1. #if UNITY_IOS
    was ignored in my case. I remove this directive, and all works as expected now. Looks like it is my local issue.

    Thanks for help.
     
  28. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    > Its strange, but it works even without coroutine. Neither the less I updated my code accordingly, thanks for advice
    Coroutine was just an example, you can skip a frame absolutely any way you like.

    > I found that postprocessor code inside platform dependent compilation directive
    Do you know a way to reproduce that issue (especially, I'd like to know what version of Unity you're on)? UNITY_IOS must be defined by Unity when building for iOS. Removing that ifdef can break your builds for other platforms.

    Best regards,
    Yuriy, Universal Tools team.
     
  29. unitexer

    unitexer

    Joined:
    Apr 18, 2019
    Posts:
    8
    >Its strange, but it works even without coroutine. Neither the less I updated my code accordingly, thanks for advice
    >>Coroutine was just an example, you can skip a frame absolutely any way you like.

    I got it. I mean it works even without frame skipping of any kind.

    >Do you know a way to reproduce that issue (especially, I'd like to know what version of Unity you're on)?

    I cant provide steps, it just happens on particular machines. I'll try to investigate it deeper. I use the following Unity versions: 2019.2.2 and 2019.2.6

    >Removing that ifdef can break your builds for other platforms.

    I thought that this code will be enough to avoid problems with other platforms
    Code (CSharp):
    1. if (target == UnityEditor.BuildTarget.iOS)
    2. {
    3.     ...
    4. }
     
  30. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    You're right! I forgot about this check there. Yes, you should be fine without that #if. Though, still, it is weird that UNITY_IOS doesn't always get defined when building for iOS target. We'll try to investigate what's going on.

    Best regards,
    Yuriy, Universal Tools team.
     
  31. kotsopoulos

    kotsopoulos

    Joined:
    Nov 6, 2014
    Posts:
    22
    Hi,
    After successfully running the demoserver i get those two messages when filling the url
    upload_2019-10-29_10-9-55.png
    Where i have to initialize the Manager? In the start method of UTNotificationsSample.cs or here
    upload_2019-10-29_10-11-47.png
    Because the initilize() ends here??
    Can you help me
    My only device running the server is my pc, i haven't connect an android device.
     
  32. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @kotsopoulos,

    First of all, thank you for using our asset!

    A target device or a simulator is required, Unity Editor is not one of the asset's supported target platforms. Please carefully read the manual first, and then if you have any questions on specific aspects of using the asset, I'll be glad to help you with those.

    Best regards,
    Yuriy, Universal Tools team.
     
  33. kotsopoulos

    kotsopoulos

    Joined:
    Nov 6, 2014
    Posts:
    22

    Thanks for your reply,

    I have read the manual, but because i am new to software engineering i just want to ask you something

    1)I run the demoserver in my pc
    2)In unity i have the sample scene and entering the game play
    -I fill the url of the running server na d try to send the notification, i have imported firebase too as, the manual refers.

    3)Do i have to build this scene in an android device????
    And also is responds notified 0 client
    What is my client in this case???
    The android device????
     
  34. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Yes, you need to build and run your application in an Android device or GooglePlay-enabled Android emulator. And yes, "client" is a target device in this case. You got 0 clients notified because no target devices have yet registered with your instance of DemoServer.

    It's totally fine to run DemoServer in the host computer, just make sure it's in the same local network as your Android device (f.e. they are connected to the same Wi-Fi router or Android emulator is used instead of a physical device),

    Best regards,
    Yuriy, Universal Tools team.
     
  35. kotsopoulos

    kotsopoulos

    Joined:
    Nov 6, 2014
    Posts:
    22
    I run the sample scene with the demoserver from an android device, but when i am filling the right url and trying to initialize, i am getting this error all the time : Error sending Push Registration id to DemoServer: Unknown Error
    A little help????
    i haven't change the UTNotificationsSample.cs file
     
  36. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    2 possible issues:
    1. The URL is not accessible on the target device (f.e. the host running DemoServer is in a different internal network or a firewall prevents accessing it, or DemoServer printed a wrong IP address - external IP instead of internal one). You can check it by opening the same URL in a browser on a mobile device. If it doesn't display a DemoServer page, then the URL is not accessible. In this case you'll have to figure out what exactly prevents connection. F.e., in case of the external IP address, just use the internal IP of the computer running DemoServer instead of one printed by DemoServer on start.
    2. The URL is accessible, but you're testing it with Android 9+ and didn't enable http: URLs, as explained here: https://stackoverflow.com/a/50834600.

    Best regards,
    Yuriy, Universal Tools team.
     
  37. game-dev333

    game-dev333

    Joined:
    Jan 11, 2014
    Posts:
    7
    HI,
    Is it possible to set color of text in notification?
    is it possible to add background image in the background of notification?
     
  38. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    194
    Hi,

    Contemplating purchasing your asset, but had some questions.

    1) Are the IDs sent to post a local notification saved? So I can post a notification with ID 1234, then kill the app, then start it back up and and cancel ID 1234 and it won't show? I need them to be persistent, and my own IDs, not returned to me from the system.
    2) I only use LOCAL notifications (no push), so I don't want any bloat. Is there a way to delete files/etc. to get local notify only? Hoping the code is broken out in such a way that it's possible. If not, can I pay for that as a standalone package?

    Thanks!
     
  39. rsu3d

    rsu3d

    Joined:
    Apr 15, 2013
    Posts:
    3
    Hello! How can i test local notifications on android device?
     
  40. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
  41. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @breban1,

    1. It's exactly the case. You choose any ids you like and they are persistent. Yes, you can cancel them using the same id even if the app is restarted.
    2. Well, kind of. Push Notifications are disabled by default, you only enable them in the asset settings if you need them. It makes Play Services Resolver not pull any push-notifications related libraries, only AndroidX, which is used by local notifications (and its own dependencies). In iOS we rely on Unity's own implementation, so no libraries required, and if APNS is disabled in the asset settings, no push notifications related functionality is invoked.

    Best regards,
    Yuriy, Universal Tools team.
     
  42. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @che187,

    Schedule a notification then close or minimize your app. When the scheduled time arrives, you'll see your notification. Also, see the manual, section "Creating Local Notifications".

    Best regards,
    Yuriy, Universal Tools team.
     
  43. rsu3d

    rsu3d

    Joined:
    Apr 15, 2013
    Posts:
    3
    Thank you very much for your answer, @Yuriy-Ivanov!
    A lil bit on native language... Can i test local notifications by changing date and time on device?
    Прошу прощения, мне так проще будет. Могу ли я получать пуши путем изменения даты и времени? У меня получается, но при последующем запуске приложения, когда создаются очередные пуши, они таким путем уже не приходят. При запуске юзаю CancelAllNotification, далее Post, потом Schedule. Не подскажите в чем может быть причина?
     
  44. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Это потому что вы используете (это настройка по-умолчанию) ELAPSED_REALTIME_WAKEUP таймер, который специально сделан для случаев, когда реагирование на перевод системных часов нежелательно, например - какое-то исследование в игре завершено, и перевод часов - это чит. Выбирайте RTC или RTC_WAKEUP, и таймер станет чувствительным к переводу часов:
    upload_2019-11-12_19-36-5.png
    Кстати, вы неверно используете слово "пуши". Пуш уведомлениями называются лишь те уведомления, что отправляются с сервера используя соответствующий сервис пуш-уведомлений, такой как FCM или APNS.

    Best regards,
    Yuriy, Universal Tools team.
     
    Last edited: Nov 12, 2019
  45. rsu3d

    rsu3d

    Joined:
    Apr 15, 2013
    Posts:
    3
    @Yuriy-Ivanov, спасибо большое! С RTC и elapsed_time я разобрался. Подскажите, пожалуйста, что означает wakeup? И у меня есть еще вопрос. У меня два типа локальных уведомлений: сегодняшние и завтрашние. Почему при RTC после билда и не отключения телефона от компьютера уведомления приходят с переводом времени и даты. Однако, если отсоединить девайс, то приходят только сегодняшние? версия 1.8.2
     
  46. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    См. https://developer.android.com/reference/android/app/AlarmManager.html#RTC vs. https://developer.android.com/reference/android/app/AlarmManager.html#RTC_WAKEUP.

    > Однако, если отсоединить девайс, то приходят только сегодняшние? версия 1.8.2
    Можно узнать конкретные шаги по воспроизведению проблемы, во всех подробностях? Важно также узнать конкретную модель устройства и версию Android.
    Спасибо!

    Best regards,
    Yuriy, Universal Tools team.
     
  47. kotsopoulos

    kotsopoulos

    Joined:
    Nov 6, 2014
    Posts:
    22
    I run the sample scene with the demoserver from an android device, but when i am filling the right url and trying to initialize, i am getting this error all the time : Error sending Push Registration id to DemoServer: Unknown Error
    A little help????
    i haven't change the UTNotificationsSample.cs file

    The URL is accessible on the target device, ihave tested but it gives me this error

    Why??
     
  48. Yuriy-Ivanov

    Yuriy-Ivanov

    Joined:
    Jun 12, 2015
    Posts:
    495
    Hi @kotsopoulos,

    Please make sure 2 things:
    1. You specified the protocol and the port number in the URL and didn't include the last "/" in the address. I.e. the URL should be in the form of:
    http://<ip_address>:8080
    2. If it's Android 9+, plaintext HTTP is requested for your app in Assets/Plugins/Android/AndroidManifest.xml. For more details see https://stackoverflow.com/a/50834600.

    Please let me know if you're still experiencing difficulties connecting to the DemoServer, I'll try to find out what's going on and how you can fix it.

    Best regards,
    Yuriy, Universal Tools team.
     
  49. kotsopoulos

    kotsopoulos

    Joined:
    Nov 6, 2014
    Posts:
    22
    Hi,

    I have filled the correct URL (http://192.168.0.10:8080) and i have 8.1.0 OPM1 android version
    I still have the same issue
     
  50. kotsopoulos

    kotsopoulos

    Joined:
    Nov 6, 2014
    Posts:
    22
    Yriy-Ivanov I tested the scene in different adroids and i managed when initializing to register the device but when it came to 'Notify All Registered Devices', i couldn't sent a notification.
    It says notified 0 client. but i have register 2 client devices
    Any ideas how to fix it?
    I am in your demo scene.
     
    Last edited: Dec 3, 2019