pushy / pushy-flutter

The official Pushy SDK for Flutter apps.
Apache License 2.0
21 stars 19 forks source link

notification icon grey out #30

Closed callmejm closed 3 years ago

callmejm commented 3 years ago

I have set Pushy.setNotificationIcon('ic_notification'); after Pushy.listen(); and put all ic_notification.png to all mipmap folder , but the notification is still grey out.

pushy commented 3 years ago

Hi @callmejm. We'd be glad to assist.

Is your icon showing up in greyscale, or simply a grey box? Please see this for a solution: https://clevertap.com/blog/fixing-notification-icon-for-android-lollipop-and-above/

callmejm commented 3 years ago

the icon I put inside mipmap is png format, but still same, a grey box

On Fri, 7 May 2021 at 10:37, Pushy @.***> wrote:

Hi @callmejm https://github.com/callmejm. We'd be glad to assist.

Is your icon showing up in greyscale, or simply a grey box? Please see this for a solution:

https://clevertap.com/blog/fixing-notification-icon-for-android-lollipop-and-above/

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pushy-me/pushy-flutter/issues/30#issuecomment-834016397, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVCTXMX4FQLFHXBXQOWSC3TMNG6BANCNFSM44IPHNAA .

pushy commented 3 years ago

Hi @callmejm, Basically, that's happening because your notification icon is not transparent.

Please read the article again as it explains this very clearly: https://clevertap.com/blog/fixing-notification-icon-for-android-lollipop-and-above/

You must modify your notification icon to be fully transparent, with the visible logo in white pixels.

The Android system ignores all non-alpha channels in action icons and in the main notification icon. You should assume that these icons will be alpha-only. The system draws notification icons in white and action icons in dark gray.

callmejm commented 3 years ago

how to show ios notification on foreground instead of alert? I have added this code on AppDelegate.swift

if #available(iOS 10.0, *) { UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate }

On Fri, 7 May 2021 at 10:54, Pushy @.***> wrote:

Closed #30 https://github.com/pushy-me/pushy-flutter/issues/30.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pushy-me/pushy-flutter/issues/30#event-4699058335, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVCTXOT4KEH76T3DGENBNDTMNI5VANCNFSM44IPHNAA .

pushy commented 3 years ago

Hi @callmejm, 1) For in-app iOS 10+ notification banners, please also add this method override to your AppDelegate.swift :

    // Display in-app notification banners (iOS 10+) and invoke notification handler
    @available(iOS 10.0, *)
   func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
        // Call the notification handler, if defined
        Pushy.shared?.notificationHandler?(notification.request.content.userInfo, {(UIBackgroundFetchResult) in})

        // Show in-app banner (no sound or badge)
        completionHandler([.alert])
    }

2) Import the Pushy iOS SDK and UserNotifications by adding the following to the top of AppDelegate.swift:

import Pushy
import UserNotifications

3) Your AppDelegate class will need to inherit UNUserNotificationCenterDelegate.

callmejm commented 3 years ago

@pushy-me the grey out issue still exist, I already follow the instructions to generate the icon, but the icon still grey box. I have put icon into all mipmap folder and named ic_notification

callmejm commented 3 years ago

Hi @callmejm,

  1. For in-app iOS 10+ notification banners, please also add this method override to your AppDelegate.swift :
    // Display in-app notification banners (iOS 10+) and invoke notification handler
    @available(iOS 10.0, *)
   func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
        // Call the notification handler, if defined
        Pushy.shared?.notificationHandler?(notification.request.content.userInfo, {(UIBackgroundFetchResult) in})

        // Show in-app banner (no sound or badge)
        completionHandler([.alert])
    }
  1. Import the Pushy iOS SDK and UserNotifications by adding the following to the top of AppDelegate.swift:
import Pushy
import UserNotifications
  1. Your AppDelegate class will need to inherit UNUserNotificationCenterDelegate.

cant import Pushy , getting No such module 'Pushy'

pushy commented 3 years ago

Hi @callmejm, In Objective-C (Flutter iOS), please import Pushy as follows:

@import Pushy

Please let us know if it works.