Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

add support for android icons/large-icons plus ability to override with the gcm keys #46

Closed
wants to merge 2 commits into from

Conversation

ashconnell
Copy link
Contributor

This PR fixes the android lollipop issue displaying blank icons in issue #20 in a similar manner to what @macdonst mentioned

It adds support for both small-icon and large-icon, and gracefully falls back to how the plugin works prior to this PR if you don't set the android options

Small Icons:

  • add the icon key to your android options which should be a string name of the resource to use (in res/drawables etc)
  • if no android option is set, it falls back to what it currently does without this PR
  • you can also override the android option key from the server by sending an icon key to GCM

Large Icons:

  • add the largeIcon key to your android options which should be a string name of the resource to use (in res/drawables etc)
  • if no android option is set, it does nothing
  • you can also override the android option key from the server by sending a largeIcon key to GCM

@ashconnell
Copy link
Contributor Author

Also added the plugin android option iconColor which sets the background color of the icon (see http://developer.android.com/reference/android/app/Notification.Builder.html#setColor(int))

@macdonst
Copy link
Member

@Deminetix I'm not going to merge this pull request but I am using it as the basis to add icon support to Android. Check out https://github.com/phonegap/phonegap-plugin-push/tree/icons

Basically, following your lead and allowing users to specify a drawable for the small icon and it's background color. Not allowing it to be set via GCM.

The large icon will be set from the "image" property that comes down from GCM. It checks for remote images over http, then android assets, then res/drawables before giving up and using the app icon.

Let me know what you think.

@macdonst macdonst closed this Jul 23, 2015
@jayeshjain24
Copy link

@macdonst The large icon works seamlessly with drawables when pushed from GCM. But I am tired of testing my app again and again. I have tried literally everything from the docs that are mentioned here. Passed in the req params at initialization. Given drawables path,full url as icon but it just does not work.

I still dont know how to solve this problem.

  • remove small icon completely
  • provide custom small icon
  • show status bar icon instead of blank square.

status-bar

notification-tray

I moved from a pushplugin which was deprecated and dont wanna move to another plugin. can you please help?

@macdonst
Copy link
Member

macdonst commented Feb 9, 2016

@jayeshjain24 can you post your small icon file here?

@jayeshjain24
Copy link

Some of the things that I tried..

android: {
"senderID": "123456789"
"icon": "http://minio.co/images/jayeshjain.jpg"
}

android: {
"senderID": "123456789"
"icon": "icon" //refers to icon in drawables.
}

icon

I just picked up an image from drawable-mdpi folder. I used ionic resources to crop icons and splashscreen which deposited few drawables folder while creating a build. I didnt create any custom image or drawable folder and let ionic do the job for me. Hope I am clear

@macdonst : updated!

@lock
Copy link

lock bot commented Jun 3, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants