Quickstart-android: Large icons not applied in FCM notification

Created on 16 Jul 2016  Â·  17Comments  Â·  Source: firebase/quickstart-android

When FCM auto creates a notification using notification payload, when our app is in background, there is no large icon added to the notification.

The notification payload only has parameters like icon (which is small icon), color (background color when there is no large icon). There is no option to provide custom large icon!

Most helpful comment

hey is there any info about the support for Large icons in FCM notifications.

All 17 comments

You are correct, currently there is no support for the large icon through the FCM notification message payload. Your request is noted and I will take it back to the team.

@kroikie if the issue is closed, how are we supposed to know if this gets supported in some stage?

@kroikie please keep this issue open and when you close this issue plz let us know how to do that.. plz

hey is there any info about the support for Large icons in FCM notifications.

how to add sound when app is not running and get fcm notification?

@kinjal444
Add this to your notification payload json.

"sound": "default"

what about icon ?

On Sat, Jun 10, 2017 at 1:21 PM, divkala notifications@github.com wrote:

@kinjal444 https://github.com/kinjal444
Add this to your notification payload json.

"sound": "default"

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/firebase/quickstart-android/issues/84#issuecomment-307549679,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AYqTzuH0ke9ex-BKDaU5A3nJwKTCznCJks5sCksTgaJpZM4JN93s
.

@kinjal444 struggling with that myself.
"icon": "ic-launcher" does not work for me, I get a grey box.
Do help out if you have a solution. Thanks.

Any solution to this?

Hi @shaik41 large icon is not supported by the SDK at this time. If you want to do so you will have to do it client side via a data-message.

Thanks @kroikie, I already do that when my application is in foreground. Can I do this when the application is closed/suspended?. I tried the icon field in the notification payload but that did not help either.

@shaik41 when you use a data-message you must write code to build the notification. Your app would receive data messages even when the app is closed/suspended and your code will have an opportunity to build a message with a large icon.

@kroikie Interesting, here is what I understood from the Firebase Documentation. The method "MessageReceived" in the FirebaseMessagingService gets called only if application is in the foreground, allowing me to access the data-message using which i can create the notification with the large icon. If the application is in background this method does not get called and the notification is automatically created by FCM which will not have the large icon. Did I miss something?

@shaik41 data-messages are always processed by the onMessageReceived callback whether the app is in the foreground or background. With data-messages you are always responsible for handling the message, in your case creating a notification with a large icon.

notification-messages (and notification-messages with data payloads) are processed by onMessageReceived when the app is in the foreground (similar to how data-messages are handled). When the app is in the background the FCM SDK automatically generates a notification, this notification does not use the large icon.

Ok @kroikie got you! Thanks. We however cannot use only data-messages because the payload is same for android and iOS. iOS always requires a notification-message. Thanks again using only data-message will help but I have to tell my backend engineer to maintain different payloads for both platforms.

@shaik41 Please take a look at the new FCM HTTP v1 API. This API allows you to send different messages eg: Notification message to iOS and data message to Android in a single request.

you can edit the extras in hadleIntent on firebase 11.4.2 to delete notification

@Override
    public void handleIntent(Intent intent) {
        String action = "com.google.android.c2dm.intent.RECEIVE";
        intent.setAction(action);
        intent.putExtra("message_type","gcm");

        intent.removeExtra("gcm.notification.badge");
        intent.removeExtra("gcm.notification.e");
        intent.removeExtra("gcm.notification.sound");
        intent.removeExtra("gcm.notification.title");

        super.handleIntent(intent);

    }
Was this page helpful?
0 / 5 - 0 ratings

Related issues

tekinarslan picture tekinarslan  Â·  5Comments

charlizesmith picture charlizesmith  Â·  5Comments

UttamPanchasara picture UttamPanchasara  Â·  4Comments

rosariopfernandes picture rosariopfernandes  Â·  6Comments

the-dagger picture the-dagger  Â·  4Comments