Rjun
Rjun

Reputation: 406

GCM Push Notification icon is not visible in Ionic app

I have developed app using Ionic Framework, and implemented GCM push notification using this plugin, it is working fine with the device of android version below 4.4 (kitkat), i am able to see notification icon.

But devices with android version more than 5.x (lolipop) notification icon is not visible.

Here is my ctrl code,

    var pushNotification = window.plugins.pushNotification;
    pushNotification.register(successHandler, errorHandler,
        {
            'senderID': 'xxxx', 'icon': 'icon', 'ecb': 'onNotificationGCM' 
        });

   function onNotificationGCM(e) {
    switch (e.event) {
        case 'registered':
            if (e.regid.length > 0) {
                registerDeviceForNotification();
            }
            break;

        case 'message':
            if (e.foreground) {
                // When the app is running foreground.
                }
            }
            $rootScope.notificationCount =  $rootScope.notificationCount + 1;
            break;

        case 'error':
            console.log('Error: ' + e.msg);
            break;

        default:
            console.log('An unknown event was received');
            break;
    }
}

Any help will be appreciated.

Upvotes: 0

Views: 2150

Answers (3)

Ruchira Randana
Ruchira Randana

Reputation: 4179

There's a change with Android 5 regarding the notification icons. Have a look at the following links to get an idea.

Upvotes: 0

ddepablo
ddepablo

Reputation: 677

Android 5+ will take your image and replace all non transparent pixes with white. If there is no transparency, probably you will see blank image or none.

You can generate your icon using this website.

Then, save the icon in resources folder and run $ ionic resources --icon

Upvotes: 2

Rubber
Rubber

Reputation: 66

upper Android M (Api 22) the status bar and notification icons, are supported in B/W PNG 16bit , with other configuration, you can view a strange B/W icon or nothing

Upvotes: 1

Related Questions