Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 6.0: notification icon does not change #1222

Closed
tschuppi opened this issue Feb 21, 2017 · 3 comments
Closed

Android 6.0: notification icon does not change #1222

tschuppi opened this issue Feb 21, 2017 · 3 comments

Comments

@tschuppi
Copy link

Hi,

My Environment

Plugin version: Latest
Platform: Android
OS version: 6.0+
Device manufacturer / model: Nexus 5
Cordova version (cordova -v): 6.3.1
Cordova platform version (cordova platform ls): 5.2.2

Plugin config

                'icon = "file://images/" + icon;
                cordova.plugins.notification.local.schedule({
                    id: data.msgType,
                    title: title,
                    text: data.message,
                    icon: icon,
                    data: {
                        sender: data.sender,
                        msgType: data.msgType
                    }
                });'

I simply want to assign a custom image that will be displayed instead of "icon" and "smallIcon".

Expected Behavior

The standard 'bell icon' with grey background should be replaced by my image file.

Actual Behavior

The 'bell icon' with grey background is still displayed.

Context

I tried different file paths, but there was no change. When i placed my favorable image in "res"-folder and changed the icon parameter to 'icon' it displayed a white rectangle, but thats not what i wanted.
Before Android 6.0 everything worked fine with the code snippet above.

@rwillett
Copy link
Collaborator

rwillett commented Feb 23, 2017

You have the notification png in the wrong place. You need to use a hook to move the icon to the right place in the android platforms. Google for "cordovas hook android notification icon".

@tschuppi
Copy link
Author

Thanks! That was the correct impulse for me.
Solved the problem with the following knowledge:

https://cordova.apache.org/docs/en/6.x/guide/appdev/hooks/index.html
https://gist.github.com/dpogue/a382e9f048b09d490d4e
https://github.com/katzer/cordova-plugin-local-notifications/wiki/10.-URIs

Next problem is: I am able to change the white icon in the center, but how can i change the background color?

@tschuppi
Copy link
Author

tschuppi commented Feb 23, 2017

Found the solution:

#874

Color Attribute is missing in the documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants