Search Unity

Official Mobile Notification Package

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

  1. Nola_Totoc

    Nola_Totoc

    Joined:
    Jun 25, 2018
    Posts:
    6
    On Android, two remarks:

    Firstly with onSentNotification in AndroidNotificationCenter.cs, some fields in AndroidNotification aren't assigned like intentData, smallIcon, ...

    Code (CSharp):
    1. public void onSentNotification(AndroidJavaObject notificationIntent)
    2.             {              
    3.                 var notification = new AndroidNotification();
    4.  
    5.                 var id = notificationIntent.Call<int>("getIntExtra", "id", -1);
    6.                 var channel = notificationIntent.Call<string>("getStringExtra", "channelID");
    7.                 notification.title = notificationIntent.Call<string>("getStringExtra", "textTitle");
    8.                 notification.text = notificationIntent.Call<string>("getStringExtra", "textContent");
    9.                 notification.shouldAutoCancel = notificationIntent.Call<bool>("getBooleanExtra", "autoCancel", false);
    10.                 notification.usesStopwatch =
    11.                     notificationIntent.Call<bool>("getBooleanExtra", "usesChronometer", false);
    12.                 notification.fireTime = notificationIntent.Call<long>("getLongExtra", "fireTime", -1L);
    13.                 notification.repeatInterval = notificationIntent.Call<long>("getLongExtra", "repeatInterval", -1L);
    14.                 notification.style = notificationIntent.Call<int>("getIntExtra", "style", -1);
    15.                 notification.color = notificationIntent.Call<int>("getIntExtra", "color", -1);
    16.                 notification.number = notificationIntent.Call<int>("getIntExtra", "number", -1);
    17.  
    18.                 OnNotificationReceived(id, notification, channel);
    19.             }
    Secondly with GetLastIntentData in AndroidNotificationCenter.cs, only data is retrieved from the intent. Isn't it possible to retrieve all the informations ? I tried it from my side and I didn't manage.

    Code (CSharp):
    1. public static string GetLastIntentData()
    2.         {
    3.            
    4.             AndroidJavaClass UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
    5.             AndroidJavaObject currentActivity = UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
    6.             AndroidJavaObject intent = currentActivity.Call<AndroidJavaObject>("getIntent");
    7.                
    8.             var data = intent.Call<string> ("getStringExtra", "data");
    9.             return data;
    10.         }
     
  2. Nola_Totoc

    Nola_Totoc

    Joined:
    Jun 25, 2018
    Posts:
    6
    For now, you can't. The callback works only when game is already launched. Normally, it's planned in the next release.
     
  3. Hien1998

    Hien1998

    Joined:
    Jan 3, 2019
    Posts:
    3
    oh, tks, but when I Export project android and build with android stuido then click notification not open game??
     
  4. Nola_Totoc

    Nola_Totoc

    Joined:
    Jun 25, 2018
    Posts:
    6
    I think that you have the same issue than me. Do you have a CustomActivity that extends the UnityPlayerActivity in your AndroidManifest.xml ? I can't open the game anymore when I press on the notification if I use a custom activity.
     
  5. segant

    segant

    Joined:
    May 3, 2017
    Posts:
    196
    Hi, I'm using your package and sometimes it send so many even that i clear all in every game start
    So here is my code below to send notification.
    Code (CSharp):
    1.    public void SendNotification()
    2.     {
    3.         AndroidNotificationCenter.CancelAllDisplayedNotifications();
    4.         AndroidNotificationCenter.CancelAllScheduledNotifications();
    5.         AndroidNotificationCenter.CancelAllNotifications();
    6.         var c = new AndroidNotificationChannel()
    7.         {
    8.             Id = "anahatirlatma",
    9.             Name = "Default Channel",
    10.             Importance = Importance.High,
    11.             Description = "Generic notifications",
    12.         };
    13.  
    14.         AndroidNotificationCenter.RegisterNotificationChannel(c);
    15.         AndroidNotification[] androidNotifications = new AndroidNotification[7];
    16.         for (int i = 0; i < androidNotifications.Length; i++)
    17.         {
    18.             androidNotifications[i].Title = LanguagesandStrings.current.bildirimbaslik;
    19.             androidNotifications[i].Text = LanguagesandStrings.current.bildirimtext;
    20.             androidNotifications[i].LargeIcon = "icon_0";
    21.             androidNotifications[i].SmallIcon = "icon_1";
    22.             androidNotifications[i].FireTime = System.DateTime.Now.AddHours((i + 1) * 24);
    23.             AndroidNotificationCenter.SendNotification(androidNotifications[i], "anahatirlatma");
    24.         }
    25. }
     
  6. pvfortes

    pvfortes

    Joined:
    Dec 17, 2017
    Posts:
    1
    From the tests I've done with package preview 13 (actually this preview is not available directly from the Unity Manager), if you don't exit the application and cancel all notifications through the supposed proper methods, it works. If you close the app and re-open it, no longer works. The only way I had to counter this problem was to save the id of each notification I made and cancel 1 by 1 using CancelNotification(Int32). Hope this helps anyone with this problem and that the developer can fix this in the next build.
     
  7. thomasglitchr

    thomasglitchr

    Joined:
    Mar 17, 2015
    Posts:
    9
    Hello,

    I'm testing this package on iOS 12 and it works well. Still, there are 2 bugs that bothers me:
    - The local notification does not play any sound
    - The local notification is not shown in foreground even with the ShowInForeground parameter set to true

    Here is my notification code if you can help me with this one:

    Code (CSharp):
    1. var timeTrigger = new iOSNotificationTimeIntervalTrigger()
    2.                 {
    3.                     TimeInterval = new TimeSpan(0, 0, 30),
    4.                     Repeats = false
    5.                 };
    6.  
    7.                 var notification = new iOSNotification()
    8.                 {
    9.                     Identifier = "mysuperid",
    10.                     Title = "My Title",
    11.                     Body = "My Body is ready",
    12.                     ShowInForeground = true,
    13.                     ForegroundPresentationOption = (PresentationOption.NotificationPresentationOptionAlert | PresentationOption.NotificationPresentationOptionSound),
    14.                     Trigger = timeTrigger
    15.                 };
    16.  
    17.                 iOSNotificationCenter.ScheduleNotification(notification);
    I would like this notification to be displayed in foreground as it would be in background with a small banner popping from the top of the screen. Did I do something wrong or is it a bug?

    Cheers!
     
  8. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @thomasglitchr I'm not sure what's wrong, this code works fine for me: the notification is shown while the app is still open and sound is played as well (as long as the device is not muted. I've tested on an iPhone X with 12.0.

    Maybe the app does not have the authorisation for notifications with sound? If everything required is enabled in 'Settings -> Notifications' could you please submit a bug report with the editor's bug reporter? (please specify the device you've been testing on and it's iOS version)
     
  9. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @pvfortes this is fixed in the next version, I'll try to publish it later today. It's strange that you can't get preview 13 from the package manager, though. The UI seems to be a bit buggy (it does not list full version strings for me..) but the downloading the latest one gets me preview 13. Maybe you're on 2018.2? I've bumped the minimum requirement to 2018.3 in p. 13.
     
  10. dandepeched

    dandepeched

    Joined:
    Feb 22, 2016
    Posts:
    31
    @_Paulius this bug is still present in preview 13. Is it on your list to fix?
     
  11. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    1.0.0-preview.17 was just released

    Improvements & changes:
    • [Android] Added support for notification groups:
      • Set Group property to group multiple notifications in a single thread.
      • Enable GroupSummary on a notification to use it as the summary notification for it's group.
      • GroupAlertBehaviour can be used to override the alert behaviour for all notifications in a group.
    • [Android] Added a SortKey property for Android.
      • Used to lexicographically order this notification among other notifications from the same package or the same notification group.
    • [Android] Changed the GetLastIntentData method to GetLastNotificationIntent it nows returns a AndroidNotificationIntentData object (which encapsulates the received AndroidNotification and it's Channel and Id) instead of just a string:
      • OnNotificationReceived now returns AndroidNotificationIntentData.
      • Arbitrary data can be stored in the AndroidNotification.intentData field.
    • [iOS] Added GetLastNotification method to iOSNotificationCenter :
      • Can be used to retrieve the notification which was used to open the app.
      • If any new notifications are received while the app is active they will override the original notification.
    • [iOS] Exposed additional iOSNotificationSettings properties:
      • ShowPreviewsSetting indicates whether a preview of the notification's content can be shown in the lock screen.
      • AlertStyle indicates the type of alerts the user has authorized (Banner, Alert or None) for the app.
      Fixes:
      • [Android] Canceling scheduled notifications now works correctly when the app is restarted.
      • [iOS] Subscribing to OnNotificationReceived on iOS should now work, even if no other notification was called
    There is no support for explicitly specifying the alert type on iOS (banner or alert). AFAIK the UserNotifications framework does not allow that and persistent alerts can only be shown if the user explicitly enables them in settings.
     
    _Adriaan and Nola_Totoc like this.
  12. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @dandepeched can you check if you can still reproduce this with the new build? Everything seems to be saved correctly for me (however this was supposed to be fixed in preview 13).
     
    dandepeched likes this.
  13. segant

    segant

    Joined:
    May 3, 2017
    Posts:
    196
    Paulius is there still multiple notifications error? Because this is happening when you quit game and restart it doesn't cancel previous set notifications. I posted my code it in here. If it is fixed in preview-17 i will release new update to my game.
     
  14. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @segant yeah, that's fixed in the new build. It should now be possible to cancel all notifications even if they were scheduled before the app was restarted.
     
    segant likes this.
  15. segant

    segant

    Joined:
    May 3, 2017
    Posts:
    196
    Thanks for everything. I appreciate your work.
     
    _Paulius likes this.
  16. AlexanderOkochutin

    AlexanderOkochutin

    Joined:
    Jun 4, 2016
    Posts:
    1
    Hello Unity Technologies team. How can I make daily notifications that will be protected from restarting the device and will not be shown if the application is foreground.
     
    Last edited: Apr 15, 2019
  17. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    The latest preview 17 crashes on iOS when I'm creating a new authorization request.
    Before that, on preview 13, the authorization request would never have IsFinished set to true if you denied the notifications permission.
     
  18. thomasglitchr

    thomasglitchr

    Joined:
    Mar 17, 2015
    Posts:
    9
    Hello,

    Am I the only one to experience this issue each time I'm opening the mobile notifications settings panel?

    It's happening for me on Mac OS X with Unity 2018.3.7 and Unity 2018.3.12.

    This error prevents me from saving the iOS Push Notification setting that is reset every time.
     
  19. dandepeched

    dandepeched

    Joined:
    Feb 22, 2016
    Posts:
    31
    It is fixed in preview 17. Thanks!
     
  20. sucineri2

    sucineri2

    Joined:
    Nov 26, 2015
    Posts:
    1
    Hello. My game uses firebase cloud messaging for remote push notification and I followed the firebase setup instruction here to change my android's main activity to
    Code (javascript):
    1. <activity android:name="com.google.firebase.MessagingUnityPlayerActivity">
    when I implemented local notification with this package, as @Nola_Totoc pointed out above, clicking on the notification would not open the game. Is there anyway to make them both work nicely together?
     
  21. namnq

    namnq

    Joined:
    Oct 24, 2018
    Posts:
    2
    I got the same issue. I've fixed it by copying the whole package folder ( in *project_folder*/Library/PackageCache) to asset folder and change the activity to com.google.firebase.MessagingUnityPlayerActivity in method GetUnityActivity():

    Code (JavaScript):
    1. public static Class<?> GetUnityActivity()
    2.     {
    3.         String className = "com.google.firebase.MessagingUnityPlayerActivity";
    4.         try
    5.         {
    6.             return Class.forName(className);
    7.         }
    8.         catch (ClassNotFoundException ignored) {}
    9.         return null;
    10.     }
     
    Last edited: Apr 19, 2019
  22. Nackwork

    Nackwork

    Joined:
    Nov 20, 2017
    Posts:
    3
    Hi, Paulius!
    Just FYI! We have faced pretty much the same error, @needforbleed was having:

    E Unity : AndroidJavaException: java.lang.NoSuchMethodError: no static method with name='getNotificationManagerImpl' signature='(Landroid.app.Application;Lcom.unity3d.player.UnityPlayerActivity;)Ljava/lang/Object;' in class Ljava.lang.Object;
    04-19 11:44:44.282 18862 18882 E Unity : java.lang.NoSuchMethodError: no static method with name='getNotificationManagerImpl' signature='(Landroid.app.Application;Lcom.unity3d.player.UnityPlayerActivity;)Ljava/lang/Object;' in class Ljava.lang.Object;
    04-19 11:44:44.282 18862 18882 E Unity : at com.unity3d.player.ReflectionHelper.getMethodID(Unknown Source:167)

    We've tracked compatibility issue with Proguard. The error above only appears if you enable Proguard either for Development or Release builds.
     
    nam2671998 likes this.
  23. Marnelle

    Marnelle

    Joined:
    Apr 14, 2015
    Posts:
    17
    Notifications are not showing after device restart

    Code (CSharp):
    1. DateTime current = DateTime.Now;
    2.         DateTime nextNotificationDate = current;
    3.         nextNotificationDate = nextNotificationDate.AddDays(1);
    4.         nextNotificationDate = nextNotificationDate.AddHours(19 - current.Hour);
    5.         nextNotificationDate = nextNotificationDate.AddMinutes(55 - current.Minute);
    6.  
    7.         var notification = new AndroidNotification();
    8.         notification.Title = title;
    9.         notification.Text = message;
    10.         notification.SmallIcon = "small";
    11.         notification.LargeIcon = "large";
    12.         notification.RepeatInterval = TimeSpan.FromDays(3);
    13.         notification.FireTime = nextNotificationDate;
    14.  
    15.         AndroidNotificationCenter.SendNotification(notification, "channel_id");
     
  24. odinrossi

    odinrossi

    Joined:
    Oct 5, 2015
    Posts:
    6
    I want to schedule notification when app is closed, this doesn't work, why?

    (i have also tried without unity wrapper from github, with simple notification code from :
    https://docs.unity3d.com/Packages/com.unity.mobile.notifications@1.0/manual/index.html, but still doesn't works)

    Code (CSharp):
    1. private void OnApplicationQuit()
    2.     {
    3.                 _localNotificationManager.ScheduleNotification("TEST", "TEST", System.DateTime.Now.AddMinutes(1));
    4.     }
    When i'm calling this my method in game (while game running) i'm getting notification on screen.


    I have also tried to listen event Application.quitting, with this code example, again this not works!Why?

    Code (CSharp):
    1. Application.quitting += Application_quitting;
    2.  
    3. private void Application_quitting()
    4.         {
    5.             var notification = new AndroidNotification();
    6.             notification.Title = "SomeTitle";
    7.             notification.Text = "SomeText";
    8.             notification.FireTime = System.DateTime.Now.AddSeconds(10);
    9.  
    10.             AndroidNotificationCenter.SendNotification(notification, "channel_id");
    11.  
    12.         }
    I have also tried to send notification from OnDestroy() event, doesn't work. Only works if player is in game..But what is happening if i want to to schedule notification when user exit app?

    Is this package tested?
     
  25. Havokki

    Havokki

    Joined:
    Jun 28, 2015
    Posts:
    118
    I’m having some issues with the Android icons in 1.0.0-preview.17.

    Every time Unity is opened, the notification settings are saying the icons cannot be used because of some reason. The reason is not shown in the error. Re-adding the icons gets rid of the error until Unity is closed and opened again.

    The icons are also shown as grey squares on a device when the icons are defined in the settings. Moving the icons to Assets/Plugins/Android/res/drawable fixes this. I used names “small_icon” and “large_icon” in my code, in the settings, and even for the files themselves.
     
  26. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    1.0.0-preview.21 is available:
    • Fixed the issue with NullReferenceException: Object reference not set to an instance of an object when changing tabs in the settings (@thomasglitchr)
    • Icon textures should be re-verified whenever the target asset is changed (without having to close and open the editor) (@Yozaro )
    • `AuthorizationRequest` should finish properly even when the user reject the request (@Devil_Inside). However I couldn't reproduce the crash, maybe you could send me the stacktrace?
    @odinrossi what device you're using? It seems to work fine for me on an S9 or Pixel 2. Seems that some Xiaomi or Huawei (and possibly other) utilize aggressive battery saver techniques which kill apps running in the background (I don't really have a decent solution for this besides what's suggested in that SF thread).

    @AlexanderOkochutin for Android all scheduled notifications should be recreated on device restart if you enable this in `Project Settings -> Mobile Notifications`. There is currently no way for not show notification when the app is in foreground for Android, we'll implement this in a future version.

    @namnq, @Nackwork we'll try to solve both of these in the next version.
     
  27. namnq

    namnq

    Joined:
    Oct 24, 2018
    Posts:
    2
    This package is working fine. You should try to do some researches first. OnApplicationQuit is not guaranteed to be called on mobile platforms. Shold use OnApplicationPause instead.
     
  28. CentauriDev

    CentauriDev

    Joined:
    Oct 8, 2018
    Posts:
    3
    Hi, i cant seem to get it to work and the guide is not very detailed, i dont know if i should import the sample project to do it. Because when i try to write the scripts from the guide it cant find AndroidNotificationChannel for an example. But when i try to import the scripts from the sample project it says that i cant do it with version 4 C#? Can anybody help? (PS: I have tried to use the sample scene and it didn't work)
     
  29. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    Last edited: Apr 26, 2019
  30. CentauriDev

    CentauriDev

    Joined:
    Oct 8, 2018
    Posts:
    3
    @_Paulius Im using Unity 2019.1.0f2, and i can see the Mobile Notifications folder in the sample scene project, but not in my main game(probably why i get errors).
     
  31. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @CentauriDev Did you install the package in the package manager window? You'll need to enable 'Show preview packages' in the 'Advanced' dropdown.

    upload_2019-4-26_13-8-2.png
     
  32. CentauriDev

    CentauriDev

    Joined:
    Oct 8, 2018
    Posts:
    3
    @_Paulius Yeah that seems to do the job, now the guide gives a lot more sense. Thanks!
     
  33. marcola_gt

    marcola_gt

    Joined:
    Apr 19, 2017
    Posts:
    6
    @_Paulius In the TUTORIAL says that I need to enable "Reschedule Notifications on Device Restart" but I just can't find this option in Edit->Project Settings->Mobile Notification Settings. Where is it for christ sake? I don't see this option here anywhere! lol

    Can anyone help me to use the callback correctly? I just can't make it. I'm using the GitHub scripts (classes, interfaces and all). I want that when the user clicks the notification, the game goes to foreground and a method get called where the player earns 1 "point". I'm scheduling and receiving the notification, but not doing the callback. Right now (my last attempt) I have into the GameNotificationManager.OnNotificationReceived() a line at the end of the method's body calling a method from my GameManager.cs. No success at all...

    And have I understood wrong or we still don't have a solution to the notification being sent when the game is totally closed?

    Thank you and congrats for the fantastic job!
     
    Last edited: Apr 30, 2019
  34. LOLinc

    LOLinc

    Joined:
    Nov 18, 2013
    Posts:
    28
    Hi unity devs!

    Thank you for building this package, as it could help us purge our project of more bloating third-party tools.
    Is there any plans for displaying notification statistics on the unity service dashboard or elsewhere?
     
  35. unity_Co_fivi4lWiBuA

    unity_Co_fivi4lWiBuA

    Joined:
    Apr 12, 2019
    Posts:
    3
    We have the same problem @Nackwork has commented in this post, even if we don't enable proguard we still receive this native error on logcat:
    We are using Unity 2018.3.12f1 and the last package version (1.0.0-preview.21).

    I have seen here you're aware about that, @_Paulius do you have an estimation date for next version of the package?

    Thanks!
     
  36. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    Does this support custom SFX, and if not is it planned?
     
    _Adriaan likes this.
  37. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    +1 for custom notification sounds!
     
  38. Nakiruna_bossfight

    Nakiruna_bossfight

    Joined:
    Apr 9, 2018
    Posts:
    1
    @_Paulius Thanks for the awesome notification package and all the improvements!

    I am also having a problem with the notification not opening the app on Android. Similar to @Nola_Totoc , I do have a custom activity. The device I'm testing on is a Samsung Galaxy S8 with Android 9. When I plug it into my computer and read the logs, I see this whenever I tap the notification:

    Code (CSharp):
    1. 04-30 15:06:37.737  1544  3602 I ActivityManager: START u0 {act=null typ=null flg=0x30000000 cmp=ComponentInfo{com.company.project/com.unity3d.player.UnityPlayerActivity}} from uid 10981
    2. 04-30 15:06:37.738  1544  3602 D ActivityManager: Received ACTIVITY intent in key u0 {467c6b3 act=nullstartActivity cmp=ComponentInfo{com.company.project/com.unity3d.player.UnityPlayerActivity} res=-92} from uid 10006
    (swapped to com.company.project)
     
  39. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @botelho_gt the checkbox should be at the top: upload_2019-5-1_12-53-50.png

    maybe you're using an older version of the package which did not yet have it? (the sample project used to reference an older version in it's manifest so you'd need to manually update it using the package manager).

    Currently you will not get a callback if the app is not running when the notification is received. For something like this to work you'd need to check the `AndroidNotificationCenter.GetLastNotificationIntent()` after opening your app. If it was opened using a notification it will return it's contents.

    @LOLinc currently we have no specific plans to provide any kind of integration with other Unity services.

    @unity_Co_fivi4lWiBuA we'll try to ship a fix for Proguard by early next week, but I haven't seen this happening without it, we'll investigate this as well, thanks for bringing it up.

    Yes, custom sound support is planned, I'm not sure when exactly it will be available, though (probably some time later this month)
     

    Attached Files:

    _Adriaan likes this.
  40. Hien1998

    Hien1998

    Joined:
    Jan 3, 2019
    Posts:
    3
    @_Paulius, I export project android and build from android stuido, my game push notification but when I click, the game not open??
     
  41. artemku1994

    artemku1994

    Joined:
    Jan 30, 2019
    Posts:
    1
    Hi @_Paulius! I faced some issue on iOS. Need to repeat local notification every week at an established time. (For example every Monday at 18:30). On android, this is easy to implement, we have FireTime (how much time we need until 18:30) and RepeatInterval
    Code (CSharp):
    1.  var n = new AndroidNotification();
    2.   n.Title = notification.Message.Title;
    3.   n.Text = notification.Message.Message;
    4.   n.FireTime = notification.Time;
    5.    n.RepeatInterval = notification.RepeatInterval;
    But i didn't find FireTime iOS, only Trigger where we can set timeInterval or date when we should receive notification, and the Trigger Repeats property, which repeats notification only when timeInterval passes again or date matches.
    Code (CSharp):
    1. internalNotification.Trigger = new iOSNotificationCalendarTrigger
    2.                 {
    3.                     Year = date.Year,
    4.                     Month = date.Month,
    5.                     Day = date.Day,
    6.                     Hour = date.Hour,
    7.                     Minute = date.Minute,
    8.                     Second = date.Second,
    9.                     Repeats = true
    10.                 };
    or

    Code (CSharp):
    1.                 internalNotification.Trigger = new iOSNotificationTimeIntervalTrigger
    2.                 {
    3.                     TimeInterval = date.TimeOfDay,
    4.                     Repeats = true
    5.                 };
    But in my case we should have different value for FireTime and RepeatInterval like on android. Have you any tips how to implement this on iOS, please?
    Thanks!
     
    Last edited: May 4, 2019
    Teagarden and ArturSu1 like this.
  42. luvjungle

    luvjungle

    Joined:
    Dec 18, 2017
    Posts:
    59
    What size or import settings does icons needs to be?
    I have 256x256 for large and 88x88 for small, but they appears very blurry
     
  43. BenAtKano

    BenAtKano

    Joined:
    May 7, 2019
    Posts:
    1
    Thanks for this package!

    I do have a feature request, optionally specifying the notification ID on Android. Right now it seems iOSNotification takes an ID, but the Android equivalent isn't publicly exposed.

    Use case: Overwriting notifications is much simpler if you can specify your own ID, because you don't need to save the ID of whatever notification you are overwriting (you just use the same ID for both).
     
  44. UnityTest12345098

    UnityTest12345098

    Joined:
    Dec 19, 2016
    Posts:
    8
    Schedule Notif call is taking a performance hit if called in between gameplay (Not on pause) . Jitter on android if notifs are scheduled while user is playing. Any way to get rid of that?
     
  45. battlecompanytestee

    battlecompanytestee

    Joined:
    May 15, 2019
    Posts:
    2
    Thank you for this package!

    I got it working for Android pretty quickly. My main problem was the namespace (using Unity.Notifications.Android;) wouldn't work after importing the package. After restarting Unity and IDE it worked fine.

    NOTE TO ANYONE INSTALLING, RESET UNITY AND IDE AFTER IMPORTING PACKAGE!

    This is for all the other noobs like myself out there. I actually learned this from someone else who had the same problem.

    Cheers! And fear the deers!
     
    AllanRW likes this.
  46. jkampitakis

    jkampitakis

    Joined:
    Dec 27, 2015
    Posts:
    56
    Hello, I am setting the "ShowInForeground = false" but I still receive notifications while I play my game.

    Code (CSharp):
    1.  var notification = new iOSNotification()
    2.             {
    3.                 Title = title,
    4.                 Body = bodyText,
    5.                 Subtitle = "",
    6.                 ShowInForeground = false,
    7.                 CategoryIdentifier = "category_a",
    8.                 ThreadIdentifier = "thread1",
    9.                 Trigger = timeTrigger,
    10.             };
    11.  
    12.             iOSNotificationCenter.ScheduleNotification(notification);

    Any ideas?

    Thanks a lot.

    P.S.
    version: 1.0.0 - preview 14a
     
  47. nschrag_synapse

    nschrag_synapse

    Joined:
    Oct 29, 2014
    Posts:
    3
    @_Paulius, any updates on a release with a fix for the proguard issue? If that's not going to be soon, is there a workaround other than not using proguard?
     
  48. Bastienre4

    Bastienre4

    Joined:
    Jul 8, 2014
    Posts:
    191
    Hello ! I'm using Unity 2019.1.0f2 and the preview 21 of the package. In my android build, when I schedule a notification, if I let the app open the notification appear but if I close the application the notification never appear. Do you have any ideas?
     
  49. _Paulius

    _Paulius

    Mobile Developer Unity Technologies

    Joined:
    Jul 8, 2014
    Posts:
    173
    @nschrag_synapse the next release got delayed a bit. I've made a separate build with just the fix for Proguard, but it's only available on the staging repo. You'll need to add this to your
    Packages/manifest.json
    manually to get it:

    {
    "dependencies": {
    ...
    "com.unity.mobile.notifications": "1.0.0-preview.22",
    ...
    },
    "registry": "https://staging-packages.unity.com"
    }


    @Bastienre4 Does this happen when the app is in the background or when it's fully closed? Also what device are you testing on?
     
  50. Bastienre4

    Bastienre4

    Joined:
    Jul 8, 2014
    Posts:
    191
    @_Paulius I'm using a Honor 10. When the app is in front I have the notification. When it's closed the notification don't appear. When it's in background it also doesn't appear.