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

Can't Set Notification Icon For LocalNotification #1966

Closed
KSayed91 opened this issue Sep 15, 2019 · 6 comments
Closed

Can't Set Notification Icon For LocalNotification #1966

KSayed91 opened this issue Sep 15, 2019 · 6 comments

Comments

@KSayed91
Copy link

KSayed91 commented Sep 15, 2019

I tried to implement Push Notification with Firebase messaging and LocalNotification Plugin.
everything going well for Push Notification and the icon and color appear well as it in ApplicationManifset.xml

        <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/notification_icon" />
        <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/notification_color" />

image

but when try to schedule local notification I got this strange icon without color
image

Is there any way to configure icon for local notifications ?

I tried this code:

Plugins.LocalNotifications.schedule({
            notifications: [{
                ...
                smallIcon: 'res://notification_icon.png',
                ...
            }]
        });


but without any luck

@KSayed91 KSayed91 changed the title Can't Set Notification Icon when App is running Can't Set Notification Icon For LocalNotification Sep 15, 2019
@masimplo
Copy link

Take a look at this #1830
You can specify it for all notifications at build time, not per notification on runtime.

@DalianL
Copy link

DalianL commented Sep 29, 2019

Not sure if it's the same problem but I'm also getting a default Android icon in the notification itself, no matter if the asset is specified for the notification at runtime, or for all notifications in the capacitor.config.json at build time. The desired icon does however appear properly in the status bar at the top in both cases, just not inside the notification.

I also tried to change the plugin files themselves by setting the small icon there directly (which is supposed to impact both the status bar icon and notification icon according to the Android docs) through the NotificationCompat.Builder setSmallIcon (int icon) method, with assets in the right place, but that also didn't work somehow. Using the latest 1.2.1 version.

@jcesarmobile
Copy link
Member

I can't reproduce.
Make sure you are using @capacitor/android 1.2.0 or newer and also don't use the image extension, just the name.
If you are still facing the issue, create a new issue providing a sample app and filling all the new template.

@Chandrasekar-G
Copy link

I'm facing the same issue.

@eryzerz
Copy link

eryzerz commented May 5, 2020

I'm facing the same issue.

This issue already solved on capacitor >= 1.3.0

If you don't want to update, just change the code within LocalNotification.java and core-plugin-definitions.d.ts manually based on this commit 648d8a1

You can find LocalNotification.java in /node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/notification/LocalNotification.java and core-plugin-definitions.d.ts in /node_modules/@capacitor/core/dist/esm/core-plugin-definitions.d.ts

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 11, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants