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. Dismiss Notice

Change Mobile Notifications icons with editor script

Discussion in 'Editor & General Support' started by alexds9, Mar 5, 2021.

  1. alexds9

    alexds9

    Joined:
    Feb 9, 2019
    Posts:
    16
    I need to change Mobile Notifications icons with editor script, but I can't find any way to do so. Is it possible now in Unity 2020.1, and if not, how can it be requested as a new feature? upload_2021-3-5_7-18-20.png
     
  2. alexds9

    alexds9

    Joined:
    Feb 9, 2019
    Posts:
    16
    Icons you want to use for notifications can be copied into the folder: "Assets/Plugins/Android/res/drawable/".
    For example, image with the name: "icon_001.png", can be loaded by running:
    Code (CSharp):
    1. AndroidNotification notification = new AndroidNotification();
    2. notification.Text      = "Notification";
    3. notification.LargeIcon = "icon_001"; // Make sure no to include extension: ".png"
    4. notification.FireTime       = notification_date_time; // Some DateTime in the future
    5. AndroidNotificationCenter.SendNotification( notification, "notification_channel" );
     
    marllon_helloello likes this.