Cordova PushNotification Icon for Android 5.0 and above versions

Posted By : Pankaj Kumar Yadav | 29-Jun-2016


Hi all,

    This blog is for PushNotification Icon in Android 5 and above versions (phonegap).

Android includes support for material design apps and provide following elements to build Meterial design: - 
   New theme, New widgets for complex views, New APIs for custom shadows and animations.
So due to  material design, pushNotification icon shows blank.
 To resolve above issue in phonegap apps, follow the steps:

1: - Add plugin "phonegap-plugin-push"

2: - Need a transparent icon.

3: - Create a folder with name "drawable" inside res folder if not exists and put transparent icon.

4: - Now in PushNotification config, specify the icon name and background color, for Example - 

var push = PushNotification.init({
      android: {
        senderID: "xxxxxxxxxxx",
        iconColor:"icon_background_color",
        icon:"icon_name"
      },
      ios: {
        alert: "true",
        badge: "true",
        sound: "true",
        clearBadge:"true"
      },
      windows: {}
    });
 

 

Here are some links for more

https://developer.android.com/design/material/index.html,
https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md

Thanks

About Author

Author Image
Pankaj Kumar Yadav

Pankaj has been working as a Grails developer expertise in struts, spring, ejb, hibernate and angularjs framework.

Request for Proposal

Name is required

Comment is required

Sending message..