0

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.

Rjun
  • 396
  • 3
  • 16
  • For 5.x and above version you need to use black and white notification icon – Ajay Pandya Mar 29 '16 at 09:49
  • As per my understanding, app takes icon from resources.android.icon directory depending on screen resolution. However If you can provide any reference it will be helpful. – Rjun Mar 29 '16 at 09:56

3 Answers3

2

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

ddepablo
  • 677
  • 1
  • 5
  • 16
  • If I puts transparent image as icon then that will not correctly visible as app icon. For my app icon I want non transparent image. Is it possible to put different icon for app icon and push icon in ionic. – vntstudy Sep 20 '16 at 06:29
1

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

Rubber
  • 66
  • 6
  • So what actually do i need to modify in Ionic app ? Should i manually create the B/W PNG ? if so where to store it in app file structure ? – Rjun Mar 29 '16 at 10:05
  • Actually we can create only manual file for this type, maybe in the future, with the Android SDK, we can modify the icons for Android M with a tool – Rubber Mar 29 '16 at 14:42
0

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

Community
  • 1
  • 1
Ruchira Randana
  • 4,021
  • 1
  • 27
  • 24