Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

mobile notification

Discussion in 'iOS and tvOS' started by vendettav, Sep 9, 2022.

  1. vendettav

    vendettav

    Joined:
    Mar 16, 2019
    Posts:
    9
    Any one can show me some sample of IOS notification. I set up a simple like this. But nothing happen. No error alert.
    Code (CSharp):
    1. var timeTrigger = new iOSNotificationTimeIntervalTrigger()
    2.         {
    3.             TimeInterval = delivery_time.TimeOfDay,
    4.             Repeats = false
    5.         };
    6.  
    7.         var notification = new iOSNotification()
    8.         {
    9.             // You can specify a custom identifier which can be used to manage the notification later.
    10.             // If you don't provide one, a unique string will be generated automatically.
    11.             Identifier = _Identifier,
    12.             Title = "Hey! Come back to fight.",
    13.             Body = offlineCall[UnityEngine.Random.Range(0, offlineCall.Length)],
    14.             Subtitle = "Come back to fight",
    15.             ShowInForeground = true,
    16.             ForegroundPresentationOption = (PresentationOption.Alert | PresentationOption.Sound),
    17.             CategoryIdentifier = "category_a",
    18.             ThreadIdentifier = "thread1",
    19.             Trigger = timeTrigger,
    20.         };
    21.  
    22.         iOSNotificationCenter.ScheduleNotification(notification);
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,652
    You have to request users permission to send notifications and this request must not include Provisional flag, otherwise they will work silently, but nothing shows up in UI.
    For the simplest solution, go to Project Settings window and in notifications tab select the checkbox for asking for permission on startup and make sure Provisional flag is not set.
     
  3. vendettav

    vendettav

    Joined:
    Mar 16, 2019
    Posts:
    9
    At Project Setting I had set like here

    upload_2022-9-9_14-24-27.png
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,652
    Click on that "Mixed" drop down and make sure Provisional is not selected in there.
     
    vendettav likes this.
  5. vendettav

    vendettav

    Joined:
    Mar 16, 2019
    Posts:
    9
    thks. I check it again and sure it dont selected

    upload_2022-9-9_14-27-20.png