universal-tools / UTNotificationsFeedback

7 stars 0 forks source link

Bell icon for notification and duplicate notifications #94

Open abhaykap opened 5 years ago

abhaykap commented 5 years ago

Hello,

We have recently upgraded the UTNotification plugin to 1.7.3 and after that, we had this callback issue https://github.com/universal-tools/UTNotificationsFeedback/issues/91 which is fixed. But we are having a new issues:

  1. Bell icon for notification. When we receive the notification while app is in foreground, the notification icon is not the app's icon rather its a bell icon.
  2. On some devices, we receive duplicate notifications one with app icon and one with a bell icon, irrispective of app state.
abhaykap commented 5 years ago

Forgot to mention environment: We are testing on:

Android 8,

Unity 5.6.6f2

abhaykap commented 5 years ago

Hello, Another update:

As per suggestions of https://github.com/universal-tools/UTNotificationsFeedback/issues/91 if we don't include the {'notification': } key in the payload that we receive the notification with the bell icon rather than with the app icon. Please suggest the fix to have a proper app icon in the notification.

yuriy-universal-ivanov commented 5 years ago

Hi @abhaykap ,

Sorry for a late reply. The icon is to be configured in a notification profile in UTNotifications settings in Unity. The profiles then can be specified when posting a local or push notifications. You can also configure a default profile to be used when no profile was specified.

Please see section "Using Notification Profiles (Sounds, Icons and Other Attributes)" of the manual for more details on notification profiles.

P.S. Please also note that using application icons for notifications is outdated, as Android starting with version 5 automatically replaces any non-transparent pixels of a notification icon with white (or contrast) color when targetting Android API 21 and newer. So you'll have to specify a white+transparent icon for your notification profile for it to work correctly.

Best regards, Yuriy, Universal Tools team.

Nyankoo commented 5 years ago

@yuriy-universal-ivanov

I'm having the same issue and after using the following tool, instead of the bell icon I'm only seeing a square as the notification icon: https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=image&source.space.trim=1&source.space.pad=0&name=ic_stat_notification_small

The icon I'm using is a .png with transparency and white areas.

yuriy-universal-ivanov commented 5 years ago

Hi @Nyankoo ,

Please send your Assets/UTNotifications/Resources/UTNotificationsSettings.asset and the contents of folder Assets/Plugins/Android/UTNotificationsRes plus the way you show the notification (it's a call with all its arguments in case of local notifications and the complete json payload in case of push notifications) to universal.tools.contact@gmail.com, I'll check what exactly is wrong in your case.

Best regards, Yuriy, Universal Tools team.

Nyankoo commented 5 years ago

@yuriy-universal-ivanov

I just checked the Assets/Plugins/Android/UTNotificationsRes folder and it seems old files are still in there. What files (with what names) should be in there?

yuriy-universal-ivanov commented 5 years ago

@Nyankoo ,

You shouldn't touch that folder manually: its contents is updated by modifying appropriate notification profiles (and then hitting the "OK" button). UTNotifications' editor scripts are to take care of the rest. In case they failed to for whatever reason, please tell me what exactly you did step-by-step so we'll try to reproduce the issue. Then feel free to delete the incorrect notification profile and recreate it again (and don't forget to "OK" please).

Nyankoo commented 5 years ago

@yuriy-universal-ivanov

I simply created a new profile, named it at set the icons. After that, I hit "Ok". It seems Unity 2018.3.8f is throwing an error when hitting "Ok" on the default profile, so maybe I will try to re-import the whole plugin.

yuriy-universal-ivanov commented 5 years ago

It seems Unity 2018.3.8f is throwing an error when hitting "Ok" on the default profile, so maybe I will try to re-import the whole plugin.

That's obviously the problem. May I find out what's the error?

Nyankoo commented 5 years ago

@yuriy-universal-ivanov

Hm, after creating the new profile, the error seemed to have disappeared. But both the new profile and the default one have the same settings.

The only things I have in my UTNotificationsRes folder are .png files of my custom profile and 2 of the three are outdated (knprofile.png & knprofile_android5plus.png). "knprofile" is the name of the cutom profile.

yuriy-universal-ivanov commented 5 years ago

@Nyankoo ,

Not sure what exactly went wrong and whether the errors you had might have caused it. Please try doing these steps:

  1. Delete all the profiles (except default, of course)
  2. Delete the entire UTNotificationsRes folder
  3. Reconfigure all profile again, including default one (please move the icon you used initially to another folder and open from it, so our editor scripts will detect that the icons should be re-applied).
  4. Check whether there will be any errors in Unity Editor Console, and also that UTNotificationsRes contains correct files.
  5. Please inform me about the results.
Nyankoo commented 5 years ago

@yuriy-universal-ivanov

That worked!

After step 2, I got an error when reconfigure the default profile (see below), but that fixed itself apparently by waiting a bit. Unity didn't directly generate the UTNotificationsRes folder, so your script couldn't access it.

The error was: NullReferenceException: Object reference not set to an instance of an object UTNotifications.Settings.GetAndroidResourceLibFolder (System.Boolean prepareResource) (at Assets/UTNotifications/Src/Settings.cs:760) UTNotifications.NotificationProfileDialog.Apply () (at Assets/UTNotifications/Editor/SettingsEditor.cs:666) UTNotifications.NotificationProfileDialog.OnOK () (at Assets/UTNotifications/Editor/SettingsEditor.cs:653) UTNotifications.NotificationProfileDialog.OnGUI () (at Assets/UTNotifications/Editor/SettingsEditor.cs:461)

yuriy-universal-ivanov commented 5 years ago

@yuriy-universal-ivanov

That worked!

After step 2, I got an error when reconfigure the default profile (see below), but that fixed itself apparently by waiting a bit. Unity didn't directly generate the UTNotificationsRes folder, so your script couldn't access it.

The error was: NullReferenceException: Object reference not set to an instance of an object UTNotifications.Settings.GetAndroidResourceLibFolder (System.Boolean prepareResource) (at Assets/UTNotifications/Src/Settings.cs:760) UTNotifications.NotificationProfileDialog.Apply () (at Assets/UTNotifications/Editor/SettingsEditor.cs:666) UTNotifications.NotificationProfileDialog.OnOK () (at Assets/UTNotifications/Editor/SettingsEditor.cs:653) UTNotifications.NotificationProfileDialog.OnGUI () (at Assets/UTNotifications/Editor/SettingsEditor.cs:461)

Thank you for those details, we'll research the issue and make sure it's fixed before releasing 1.8.