Search Unity

Official Mobile Notification Package

Discussion in 'Android' started by _Paulius, Jan 28, 2019.

  1. JorisEertink

    JorisEertink

    Joined:
    Mar 15, 2017
    Posts:
    24
    Any update on this? :)
     
  2. Manuele8838

    Manuele8838

    Joined:
    Sep 19, 2020
    Posts:
    4
    Hello! First of all, thanks for the great package.
    I'm fairly new to Unity3d and Android (and the forum) and I'm having some problems in using the notifications.
    I'm using Android 8, Unity3d 2020.1.4f1, Mobile Notifications Package 1.3.2 and Google Firebase.
    Basically, I am:
    - creating a notification channel in Unity using the notification package
    Code (CSharp):
    1. var channel = new AndroidNotificationChannel()
    2.         {
    3.             Id = "Test_Channel",
    4.             Name = "Test channel",
    5.             Importance = Importance.High,
    6.             Description = "Test notification channel",
    7.         };
    8.         AndroidNotificationCenter.Initialize();
    9.         AndroidNotificationCenter.RegisterNotificationChannel(channel);
    - setting up a notification handler in Unity
    Code (CSharp):
    1.      
    2.     void Start()
    3.     {
    4.         AndroidNotificationCenter.OnNotificationReceived += receivedNotificationHandler;    
    5. }
    6.  
    7. public void receivedNotificationHandler(AndroidNotificationIntentData data)
    8.     {
    9.         Debug.Log("receivedNotificationHandler() IN ");
    10.         // do some stuff...
    11.     }
    12.  
    - creating a Java native plugin, that sends notifications to the Unity app when certain events happen.
    Have tried to connect to the channel specifying the same creation parameters and that didn't work, so at the moment the plugin looks for the available notification channels (there's just one, and its name / id matches the one created in Unity) and uses it this way:
    Code (CSharp):
    1.        String channelId = ANDROID_CHANNEL_ID;
    2.        NotificationManager manager = (NotificationManager) currentActivity.getBaseContext().getSystemService(Context.NOTIFICATION_SERVICE);
    3.        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
    4.             List<NotificationChannel> ls = manager.getNotificationChannels();
    5.             if (ls.size() > 0) {
    6.                 Log.i(LOGTAG, "sendNotification(): FOUND CHANNEL - " + ls.get(0).toString());
    7.                 channelId = ls.get(0).getId();
    8.             }
    9.         }
    10.         // basic notification
    11.         NotificationCompat.Builder builder = new NotificationCompat.Builder(currentActivity, channelId)
    12.                 .setSmallIcon(R.drawable.task_icon)
    13.                 .setChannelId(channelId)
    14.                 .setContentTitle(textTitle)
    15.                 .setContentText(textContent)
    16.                  .setPriority(NotificationManager.IMPORTANCE_HIGH)
    17.                 .setAutoCancel(true);
    18.         Intent notificationIntent = new Intent(currentActivity, com.google.firebase.MessagingUnityPlayerActivity.class);
    19.         notificationIntent.putExtra("action", "Event_from_plugin");
    20.         notificationIntent.putExtra("event", eventData);
    21.         PendingIntent contentIntent = PendingIntent.getActivity(currentActivity.getBaseContext(), 0, notificationIntent,
    22.                 PendingIntent.FLAG_UPDATE_CURRENT);
    23.         builder.setContentIntent(contentIntent);
    24.         m_nNotifyID++;
    25.         manager.notify(m_nNotifyID, builder.build());
    26.  
    The problem is that, when the app is in foreground, OnNotificationReceived is not invoked for the notifications fired from the plugin. In this case the notification appears in the notification bar on top of the screen, instead, like the app was in background.
    OnNotificationReceived is correctly invoked for events fired from the Unity code, instead.

    Am I doing something wrong there, or is that the expected behaviour?

    Thanks in advance for any help :)
     
    Last edited: Mar 26, 2021
  3. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Have you tried looking into logcat for your application, maybe some error gets printed there?
     
  4. Manuele8838

    Manuele8838

    Joined:
    Sep 19, 2020
    Posts:
    4
    Thanks for the reply!
    Using Android Device Monitor I only read logs from the Java plugin and everything seems ok there.
    Nothing seems to happen on Unity side, instead: no errors and no logs.
    "UnityOM" is the logtag used by the plugin, here's how the channel is seen from there:

    03-26 13:17:35.606: I/UnityOM(31953): sendNotification() IN
    03-26 13:17:35.609: I/UnityOM(31953): sendNotification(): FOUND CHANNEL - NotificationChannel{mId='Test_Channel', mName=Test channel, mDescription=hasDescription , mImportance=4, mBypassDnd=false, mLockscreenVisibility=-1000, mSound=content://settings/system/notification_sound, mLights=false, mLightColor=0, mVibration=null, mUserLockedFields=0, mUserBlockedFields=0, mFgServiceShown=false, mVibrationEnabled=false, mShowBadge=false, mDeleted=false, mGroup='null', mAudioAttributes=AudioAttributes: usage=USAGE_NOTIFICATION content=CONTENT_TYPE_SONIFICATION flags=0x0 tags= bundle=null, mBlockableSystem=false, mSnoozeException=false, mHapticId=0}

    EDIT:
    checking in the general log, I can only find this error, but I didn't set any specific ringtone, so I'm not sure it's relevant:

    03-26 14:13:09.251: D/NotificationServiceEx(1596): notification=Notification(channel=Test_Channel pri=2 contentView=null vibrate=null sound=null defaults=0x0 flags=0x10 color=0x00000000 backgroundColor=0x00000000 vis=PRIVATE)
    03-26 14:13:09.260: E/RingtonePlayer(2682): File not exist. Change default path to default notification file path
     
    Last edited: Mar 26, 2021
  5. Protokoll

    Protokoll

    Joined:
    Nov 17, 2016
    Posts:
    18
    Hello everybody

    I am currently trying to implement the mobile notifications (v.1.3.2) with an android phone (Android v.11)

    The notifications will only work when the project is builded with the status "Development Build". But how to be sure it will work with the final version (for Google Play)?

    Thank you for your helps

    PS : Sorry, just saw this topic after creating my thread...
     
  6. Manuele8838

    Manuele8838

    Joined:
    Sep 19, 2020
    Posts:
    4
    Hi, thanks for the hint, I didn't think about that setting.
    I have tried changing the Project Settings to "Development Build" but that didn't solve the problem in my case, sadly.
    Just for the record, notifications seemed to work nicely (when fired from Unity code) in production setting, at least in my case.
     
  7. Protokoll

    Protokoll

    Joined:
    Nov 17, 2016
    Posts:
    18
    When you say "Production setting", your app is availbe on Google Play or it's just for testing?

    You can try again with my sample code. It will only work with the standard mobile notifications (not with Firebase) :
    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using Unity.Notifications.Android;
    6.  
    7. public class NotificationManager : MonoBehaviour
    8. {
    9.     // Start is called before the first frame update
    10.     public void SendNote()
    11.     {
    12.         var channel =
    13.             new AndroidNotificationChannel()
    14.             {
    15.                 Id = "default_channel",
    16.                 Name = "SpeedySquare",
    17.                 Importance = Importance.Default,
    18.                 Description = "channel_description"
    19.             };
    20.  
    21.         AndroidNotificationCenter.RegisterNotificationChannel (channel);
    22.  
    23.         var notification = new AndroidNotification();
    24.         notification.Title = "Speedy Square";
    25.         notification.Text = "Someone beat the highscore!";
    26.         notification.FireTime = System.DateTime.Now.AddSeconds(10);
    27.  
    28.         AndroidNotificationCenter.SendNotification(notification, "default_channel");
    29.         Debug.Log("Send note");
    30.  
    31.     }
    32.  
    33. }
    34.  
    Maybe it will work. Let us know :)
     
  8. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Release/non-release does not have affect on working of mobile notifications package.
    What might have affect is engine code stripping level or minification settings.
     
  9. Protokoll

    Protokoll

    Joined:
    Nov 17, 2016
    Posts:
    18
    What do you mean by "minification settings"? I have only checked the box "Build App Bundle (Google Play)" . Do I need to check other settings?
     
  10. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Minify options are in Player Settings publishing section.
    Stripping is another thing to check.
     
  11. Protokoll

    Protokoll

    Joined:
    Nov 17, 2016
    Posts:
    18
    Thank you ! I need to uncheck "Release" in Minify section. Now it's working. Thank you :)
     
  12. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    I think this is worth a bug report though. We should make it work with minify too.
     
    Protokoll likes this.
  13. fabiorondina82

    fabiorondina82

    Joined:
    May 20, 2020
    Posts:
    3
    Hi Guys, I am trying to implement a notification system that uses the intent to load the target scene but after the scene is loaded the app freeze. if I pause it and move back to the app the app works fine.

    I am using Unity 2020.2f1 with AR foundation 4.0
    I use the GetLastIntent method to retrieve the string of the Intend and load the Scene.
    the first time The scene get loaded unloaded and reloaded back. I can see it because it shows the main screen, the target scene, back the main screen and the target Scene.

    The is my whole class

    using System;
    using TMPro;
    using Unity.Notifications.Android;
    using UnityEngine;
    using UnityEngine.SceneManagement;
    namespace Assets.Scripts.NotificationScripts
    {
    public class AndroidNotificationCustomClass : MonoBehaviour
    {
    //#if UNITY_ANDROID
    public AndroidNotificationChannel defaultNotificationChannel;
    private const int Identifier = 01;
    private const int Identifier02 = 02;
    private const int Identifier03 = 03;
    //Start is called before the first frame update
    [SerializeField] private TMP_Text _debugOutput;
    void Start()
    {
    //Remove all displayed notification
    //AndroidNotificationCenter.CancelAllDisplayedNotifications();
    // CHANNEL definition
    defaultNotificationChannel = new AndroidNotificationChannel()
    {
    Id = "Mandatory_Task_channel",
    Name = "Default Mandatory Channel",
    Importance = Importance.High, // max level for Android
    Description = "For Mandatory notifications",
    //CanBypassDnd = true,
    //CanShowBadge = true,
    //EnableLights = true,
    //EnableVibration = true,
    };
    // register the channel to the Android Notification Centre
    AndroidNotificationCenter.RegisterNotificationChannel(defaultNotificationChannel);
    _debugOutput.text = "channel created\n";
    ////define the notification 01
    //AndroidNotification notification = new AndroidNotification()
    //{
    // Title = "Hi there",
    // Text = "Is time to take you medication",
    // SmallIcon = "icon_0",
    // LargeIcon = "reminder",
    // FireTime = System.DateTime.Now.AddSeconds(5),
    // IntentData = "TaskSystem,Daily Medication"

    //};
    //_debugOutput.text += "notification 01 created\n";
    // define the notification 02
    AndroidNotification notification02 = new AndroidNotification()
    {
    Title = "Notification 02 T4",
    Text = "Is time to go to bed",
    SmallIcon = "icon_0",
    LargeIcon = "reminder",
    FireTime = System.DateTime.Now.AddSeconds(10),
    IntentData = "TaskSystem,Daily Medication"
    };
    _debugOutput.text += "notification with intent created\n";
    // send notification return an identifier to be able to track the notifications and check if has already been delivered
    // then perform an action depending on the results
    //Identifier = AndroidNotificationCenter.SendNotification( notification, "Mandatory_Task_channel");
    //AndroidNotificationCenter.SendNotificationWithExplicitID(notification, "Mandatory_Task_channel", Identifier);
    //_debugOutput.text += "identifier first notification is\n " + Identifier + "\n Intentdata is : \n" + notification.IntentData + "\n";
    ////Identifier02 = AndroidNotificationCenter.SendNotification( notification02, "Mandatory_Task_channel");
    AndroidNotificationCenter.SendNotificationWithExplicitID(notification02, "Mandatory_Task_channel", Identifier02);
    _debugOutput.text += "id second not " + Identifier02 + "\nIntentdata is : \n" + notification02.IntentData + "\n";
    //RECEIVE NOTIFICATION CALLBACK
    // ReSharper disable once ConvertToLocalFunction
    //AndroidNotificationCenter.NotificationReceivedCallback receivedNotificationHandler =
    // delegate (AndroidNotificationIntentData data)
    // {
    // var msg = "Notification received : " + data.Id + "\n";
    // msg += "\n Notification received: ";
    // msg += "\n .Title: " + data.Notification.Title;
    // msg += "\n .Body: " + data.Notification.Text;
    // msg += "\n .Channel: " + data.Channel;
    // Debug.Log(msg);
    // _debugOutput.text += msg + "\n";
    // };
    //AndroidNotificationCenter.OnNotificationReceived += receivedNotificationHandler;
    //CHECK IF THE APP WAS OPENED USING A NOTIFICATION, IF IS OPEN WITH ANY OTHER METHOD WILL RETURN NULL
    //var notificationIntentData = AndroidNotificationCenter.GetLastNotificationIntent(); // POSSIBLE METHOD TO DUPLICATE
    //if (notificationIntentData != null)
    //{
    // Debug.Log("notification used" + notificationIntentData);
    // _debugOutput.text = "notification intent is\n" + notificationIntentData.Notification.IntentData + "\n";
    // //_debugOutput.text += "App was opened with notification!\n" + notificationIntentData + "\n";
    // string[] intent = notificationIntentData.Notification.IntentData.Split(':');
    // //_debugOutput.text += "split intents are \n" + intent[0] + "\nand\n" + intent[1];
    // if (intent[0] == "TaskSystem")
    // {
    // PlayerPrefs.SetString("activeTask", intent[1]);
    // //SceneManager.LoadScene(notificationIntentData.Notification.IntentData);
    // SceneManager.LoadScene(intent[0]);
    // //_debugOutput.text += "intent is : " + notificationIntentData.Notification.IntentData;
    // }
    //}
    var notificationIntentData = AndroidNotificationCenter.GetLastNotificationIntent();
    if (notificationIntentData != null)
    {
    var id01 = notificationIntentData.Id;
    var channel01 = notificationIntentData.Channel;
    //var notification01 = notificationIntentData.Notification;
    var intnet01 = notificationIntentData.Notification.IntentData;
    //_debugOutput.text += " intents are \n" + id01 + "\nand\n" + channel01 + "\nand\n" + notification01 + "\nand\n" +intnet01;
    //_debugOutput.text = " intents data retrieved \n" + id01 + "\nand\n" + channel01 + "\nand\n" +intnet01;
    string[] intent = notificationIntentData.Notification.IntentData.Split(',');
    //_debugOutput.text += "Scene is \n" + intent[0] + "\nand Task is\n" + intent[1];
    if (intent[0] =="TaskSystem")
    {
    PlayerPrefs.SetString("activeTask", intent[1]);
    SceneManager.LoadScene(intent[0]);
    // //_debugOutput.text += "intent is : " + notificationIntentData.Notification.IntentData;
    }
    }
    //else
    //{
    // _debugOutput.text += "else triggered notificationIntentData null: ";
    //}
    }
    //private void OnApplicationfocus(bool hasFocus)
    //{
    // //CHECK IF THE APP WAS OPENED USING A NOTIFICATION, IF IS OPEN WITH ANY OTHER METHOD WILL RETURN NULL
    // var notificationIntentData = AndroidNotificationCenter.GetLastNotificationIntent(); // POSSIBLE METHOD TO DUPLICATE
    // if (notificationIntentData != null)
    // {
    // Debug.Log("On focus method" + notificationIntentData);
    // _debugOutput.text = "On focus method\n" + notificationIntentData.Notification.IntentData + "\n";
    // //_debugOutput.text += "App was opened with notification!\n" + notificationIntentData + "\n";
    // string[] intent = notificationIntentData.Notification.IntentData.Split(':');
    // //_debugOutput.text += "split intents are \n" + intent[0] + "\nand\n" + intent[1];
    // if (intent[0] =="TaskSystem")
    // {
    // PlayerPrefs.SetString("activeTask", intent[1]);
    // SceneManager.LoadScene(notificationIntentData.Notification.IntentData);
    // //_debugOutput.text += "intent is : " + notificationIntentData.Notification.IntentData;
    // }
    // }
    //}
    private void OnApplicationPause(bool pause)
    {
    // check if the notification is scheduled when the app is paused, if it is change with a different notification
    if (AndroidNotificationCenter.CheckScheduledNotificationStatus(Identifier) == NotificationStatus.Scheduled)
    {
    //TODO this part will replaced all the scheduled notification with the id on the paramenter
    //// If the player has left the app and the app is not running . Send them a new notification
    //AndroidNotification newNotification = new AndroidNotification()
    //{
    // Title = "General Reminder Notification!",
    // Text= "You have paused the Task",
    // SmallIcon = "icon_0",
    // LargeIcon = "reminder",
    // FireTime = System.DateTime.Now
    // //RepeatInterval = new TimeSpan(0,0,0,15), // repetition time should not be needed now
    //};
    ////Replace the currently scheduled notification with a new notification.
    //AndroidNotificationCenter.UpdateScheduledNotification(Identifier , newNotification , "Mandatory_Task_channel");
    }else if (AndroidNotificationCenter.CheckScheduledNotificationStatus(Identifier) ==
    NotificationStatus.Delivered)
    {
    _debugOutput.text = "Notification received";
    var notificationIntentData = AndroidNotificationCenter.GetLastNotificationIntent(); // POSSIBLE METHOD TO DUPLICATE
    if (notificationIntentData != null)
    {
    Debug.Log(" received method" + notificationIntentData);
    _debugOutput.text += "received method\n" + notificationIntentData.Notification.IntentData + "\n";
    //_debugOutput.text += "App was opened with notification!\n" + notificationIntentData + "\n";
    string[] intent = notificationIntentData.Notification.IntentData.Split(',');
    _debugOutput.text += "split intents are \n" + intent[0] + "\nand\n" + intent[1];
    //if (intent[0] == "TaskSystem")
    //{
    // PlayerPrefs.SetString("activeTask", intent[1]);
    // SceneManager.LoadScene(intent[0]);
    // //_debugOutput.text += "intent is : " + notificationIntentData.Notification.IntentData;
    //}
    }
    //Remove the notification from the status bar
    //AndroidNotificationCenter.CancelNotification(Identifier);
    }else if (AndroidNotificationCenter.CheckScheduledNotificationStatus(Identifier) ==
    NotificationStatus.Unknown)
    {
    AndroidNotification notification = new AndroidNotification()
    {
    Title = "Test Notification!",
    Text= "This is a test notification, but because the status was unknown",
    SmallIcon = "icon_0",
    LargeIcon = "reminder",
    FireTime = System.DateTime.Now.AddSeconds(10),
    //RepeatInterval = new TimeSpan(0,0,0,15), // repetition time should not be needed now
    };
    //Try sending the notification again
    //Identifier = AndroidNotificationCenter.SendNotification(notification, "Mandatory_Task_channel ");
    AndroidNotificationCenter.SendNotificationWithExplicitID(notification, "channel_id", Identifier);
    }
    }
    // fixed public method
    public void SendReminderNow(string title, string body )
    {
    ShowNotificationAfterDelay(title, body, DateTime.Now);
    }
    //public general method
    public void ShowNotificationAfterDelayDateTime(string title, string body , DateTime time)
    {
    ShowNotificationAfterDelay(title, body, time);
    }
    //original private method
    private void ShowNotificationAfterDelay(string title, string body , DateTime time)
    {
    AndroidNotification reminderNotification = new AndroidNotification()
    {
    Title = title,
    Text = body,
    SmallIcon = "icon_0",
    LargeIcon = "reminder",
    FireTime = time,
    //IntentData = "TaskSystem,Daily Medication"
    };
    _debugOutput.text += "reminder created\n";
    AndroidNotificationCenter.SendNotificationWithExplicitID(reminderNotification, "Mandatory_Task_channel", Identifier03);
    _debugOutput.text += "id reminder " + Identifier03 ;

    }
    }
    }
     
  14. Manuele8838

    Manuele8838

    Joined:
    Sep 19, 2020
    Posts:
    4
    Thanks for the hint. I'm glad you solved your problem already! However, my app is not on Google store, it is just compiled with the "Development option" off.
    Your code works nicely in my project, I only needed to add a notification handler to process the data in your example. Sadly, OnNotificationReceived fails to be invoked only when the notification is fired from the Java plugin using native Android APIs, so I'm still stuck on that.
    Thanks for the hint anyway :)
     
    Last edited: Mar 31, 2021
    Protokoll likes this.
  15. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    I noticed that you can't expand the notification by pulling down on it on Android. If your notification text is too long, it is truncated with no way to view the rest of the message. How do we fix this? Is there a setting somewhere?
     
  16. efl

    efl

    Joined:
    Mar 14, 2013
    Posts:
    1
  17. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
  18. MatveyAppCraft

    MatveyAppCraft

    Joined:
    Apr 19, 2021
    Posts:
    2
    Hi, your documentation says that I can use BigPicture and BigText styles, but there is only BigText and None style in the code. How can I use BigPictureStyle ?
     

    Attached Files:

  19. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Also if you could answer this:
     
  20. MTCpersian

    MTCpersian

    Joined:
    Jun 18, 2020
    Posts:
    3
    I want to schedule a notifications base on days of the week at given time (for example at 15:30 in Wednesday, Friday, Saturday ), anyone can please help me how to set the FireTime to achieve that?
     
  21. ALittleBB

    ALittleBB

    Joined:
    May 14, 2018
    Posts:
    4
    Can anyone tell me How CanShowBadge on AndroidNotification working ?
    If I set true my app should show badge number right?, but is not working for me.
     
  22. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    No, only it enables showing badge.
    To add a badge itself, you have to set Number on AndroidNotification.
     
  23. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Could you please reply to this, or should I submit a bug report?
     
  24. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
  25. Galasdaer

    Galasdaer

    Joined:
    Nov 19, 2013
    Posts:
    1
    Any news about for custom notification sounds on android devices since 2019??
     
    Last edited: Apr 30, 2021
  26. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
  27. unity_Gl0zzDezbIA93g

    unity_Gl0zzDezbIA93g

    Joined:
    Mar 4, 2021
    Posts:
    1
    Hi everyone. After almost 2 years, custom layouts have not been added, I wanted to know if they are still planned to be added? And are there people who know if you can add them yourself?
     
  28. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
  29. vasanthbalaji

    vasanthbalaji

    Joined:
    Nov 15, 2014
    Posts:
    34
    @Aurimas-Cernius

    Repeat Notifications not working for time interval greater than 2 mins (for Minute Reminder) and Greater than 1 hour (for Hourly reminder) in Android and IOS

    Have checked in Android 7(Moto E4 plus) and Android 10(Moto e7 plus) and IOS 14.2 version in Iphone XR

    Have also filed bug report .Please help me out to resolve this issue.
     
    xLeo likes this.
  30. vitaliano_fanatee

    vitaliano_fanatee

    Joined:
    Oct 9, 2020
    Posts:
    37
    I was looking into the file, com.unity.mobile.notifications@1.3.2\Runtime\iOS\iOSNotificationsWrapper.cs, and I think that there is a missing FreeHGlobal at the end of the ScheduleLocalNotification method.

    You can check it below:
    Code (CSharp):
    1.         public static void ScheduleLocalNotification(iOSNotificationData data)
    2.         {
    3. #if UNITY_IOS && !UNITY_EDITOR
    4.             IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(data));
    5.             Marshal.StructureToPtr(data, ptr, false);
    6.  
    7.  
    8.             _ScheduleLocalNotification(ptr);
    9. #endif
    10.         }
    Is there a reason to allocating the iOSNotificationData struct and not freeing it afterwards?

    My best regards,
    Vitaliano
     
  31. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    I believe that code has been rewritten complete in upcoming new release of the package.
     
    xLeo and vitaliano_fanatee like this.
  32. Quawetim-Inf

    Quawetim-Inf

    Joined:
    Mar 10, 2020
    Posts:
    10
    Hello there.

    We use this package to shedule notifications, but have some weird problem with iOS. We use iOSNotificationCalendarTrigger to shedule notification at 07:00 tomorrow, but notification arives at 00:00 today.

    Same thing with AndroidNotification works well, push arrives at 07:00 as planned.

    Package version: 1.3.2
     
  33. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Mobile Notifications package 1.4.1 is out.
    You can give it a spin.
     
  34. Nyankoooo

    Nyankoooo

    Joined:
    May 21, 2016
    Posts:
    144
    Did you submit that bug report and did you hear anything back? Really sad that this was not addressed since the last update back in 2020...
     
  35. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Nope i never got a confirmation here and with the issue being ignored I guess it was out of scope for them and not something they wanted to address. Since the developer kept evading my question.
     
    Nyankoooo likes this.
  36. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Is there a change log?
     
  37. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
  38. VaidasM

    VaidasM

    Unity Technologies

    Joined:
    Jun 27, 2017
    Posts:
    41
    Hey, could you clarify why is using Big Text not an option? Sounds like this property is exactly what you're looking for.
     
  39. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Huh, I don't know how I missed it, I didnt see NotificationStyle.BigTextStyle. When I saw the link to stack overflow I incorrectly jumped to the conclusion that I needed to edit the notification styling Java code .

    I'll give it a whirl and test it out next time I am doing on device testing, thanks for the clarification!
     
    gurbrindersingh likes this.
  40. Mese

    Mese

    Joined:
    Dec 13, 2015
    Posts:
    41
    Hi, i've got an issue and
    I've been hacking at this for the whole day:

    After clicking a notification, the intent stays ALIVE and does not clear when reopening the app, but not if opening from Android's App Drawer.
    This is quite weird so I'm going step by step:
    - I get the notification and click it
    - The app opens and the AndroidNotificationCenter.GetLastNotificationIntent(); returns the Intent nicely.
    - I minimize the app (not closing it)
    - Opening back the app from Android's openned apps menu does not clear the Intent, and I get the notification Intent again, triggering the same thing again.
    - If I open from the App Drawer, the intent is cleared

    Is there something I'm doing wrong?

    I know there's a workaround to clear the intent, but for the life of me, i cannot remenber it, can someone help?

    Thanks
     
  41. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    I think you need to call CancelDisplayedNotification() to remove it.
     
  42. Mese

    Mese

    Joined:
    Dec 13, 2015
    Posts:
    41
    I already tried that...
    Also I tried setting "ShouldAutoCancel" to true.
    Im still having the same behaviour: reopening the app from Android's opened apps menu does not clear the intent. As I said, it is very weird, because if I reopen it from the App Drawer, it does work fine
     
    Last edited: Jun 16, 2021
  43. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    Is custom notification sound support planned?
     
  44. deiva

    deiva

    Joined:
    Jul 12, 2016
    Posts:
    16
    Hi,
    Notification is not working when app in closed.
    Unity version: 2019.4.16f1
    Unity mobile notification: 1.4.1

    Kindly help on it.
     
  45. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
     
  46. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    Is there a way to use this package to attach a small thumbnail image to the push?
     
  47. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    @Aurimas-Cernius Is custom notification sound support planned, is so when can we expect, if not why?
     
  48. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    It is planned, but no timeline yet.
     
  49. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    It's been 2.5 years since launching the first version of the Notification preview and it's still doesn't have the features that most Unity Asset Store notification plugins have.
    Why does it take so long?
     
    ina and ROBYER1 like this.
  50. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Is there any way to configure location triggers with this package on Android?
     
    ina likes this.