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] Small Icon not working correctly in release build #1069

Open
humayune01 opened this issue Jul 25, 2024 · 12 comments
Open

[Android] Small Icon not working correctly in release build #1069

humayune01 opened this issue Jul 25, 2024 · 12 comments

Comments

@humayune01
Copy link

humayune01 commented Jul 25, 2024

I am having a weird issue with small icon. In the beginning, I thought it is just not working in release build because it was working with development build. So I checked other closed issues 243 and 92.

It works in the beginning or may be just for first few notifications then after sometime it shows a white circle.

I followed the notifee guide thoroughly and generated icons in Android Studio. Read about Shrinking via @mikehardy twitter link.

So I enabled minify and shrinking. I also added a keep.xml to make sure my icon is in resources and I checked APK in Android Studio resources.arsc in drawable it has the icon.

Now I don't know what to do because it was working and now it is not working automatically.

I'm using Expo latest version:
"expo": "^51.0.21"
"react-native": "0.74.3"
"@notifee/react-native": "^7.8.2"

Screenshot_1

Why it is working partially? Can anyone please help with this.. I am not getting any lead.
Thanks!!

@humayune01
Copy link
Author

humayune01 commented Jul 26, 2024

I tried to reinstall the release APK but it didn't show icon at all. Just white circle!
But then I noticed a thing.
When I dismiss any notification it shows a blank notification with my icon correctly.
Here is the video.

this is the code for background event I have:

notifee.onBackgroundEvent(async ({ type, detail }) => {
    const { notification, pressAction } = detail;
    await notifee.cancelNotification(notification?.id || '');
});

Copy link

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@humayune01
Copy link
Author

Issue still require attention and is not fixed.

@devpascoe
Copy link

devpascoe commented Sep 17, 2024

Same here, any updates?
Google Pixel 7a.

I'm finding for push notes its fine but local notes its not using the specified icon.


Update: specifying smallIcon: 'ic_notification' and adding a alpha channel transparent png worked. Had to specify when using createTriggerNotification whereas push notes get the icon applied via manifest.

@kartvya
Copy link

kartvya commented Sep 19, 2024

Im facing the same issue i have pixel 6a and also pitcture we are sending are not displaying

My code:

async function onDisplayNotification(remoteMessage: any) {
await notifee.requestPermission();
const channelId = await notifee.createChannel({
id: 'default',
name: 'Default Channel',
importance: AndroidImportance.HIGH,
vibration: true,
vibrationPattern: [300, 500],
});

await notifee.displayNotification({
  title: remoteMessage?.notification?.body,
  body: remoteMessage?.notification?.title,
  android: {
    channelId,
    smallIcon: 'ic_notification',
    pressAction: {
      id: 'default',
    },
    style: {
      type: AndroidStyle.BIGPICTURE,
      largeIcon: require('../../assets/appIcon.png'),
      picture:
        endPoints.showImage +
        remoteMessage?.notification?.android?.imageUrl,
    },
  },
});

}

Solution will be appreciated thank you.

@devpascoe
Copy link

devpascoe commented Sep 19, 2024

@kartvya here's my channel creation and payload

await notifee.createChannel({
id: 'my-channel-id',
name: 'My Channel',
description: 'Notifications for updates and reminders',
sound: 'default',
importance: AndroidImportance.HIGH,
});

await notifee.displayNotification({
title,
body,
android: {
channelId: 'my-channel-id',
importance: AndroidImportance.HIGH,
pressAction: {
id: 'default',
},
smallIcon: 'ic_notification',
color: '#E64626',
},
});

Maybe try specifying a color ;)
Or a string for channelId.

My ic_notification.png sized files are in the respective drawable-xxx folders under res. They are transparent pngs with a solid white foreground icon.

@kartvya
Copy link

kartvya commented Sep 21, 2024

@devpascoe Thanks for respose. My icons are located in minmap files is this the corret way if it's not please correct me and also i can't genrate icons for notification i don't know what is the issue with all the sites

This is how i used it and im testing in pixel devices
Screenshot 2024-09-21 at 9 47 27 PM
Screenshot 2024-09-21 at 9 47 50 PM

@KolissnikBogdan
Copy link

same +1

1 similar comment
@hochonin93
Copy link

same +1

Copy link

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@sayan-avantai
Copy link

need attention.

@kartvya
Copy link

kartvya commented Dec 4, 2024

I managed it using transparent png icon and giving that icon red color to show.

Screenshot 2024-12-04 at 12 32 20 PM

My icon -
ic_stat_name

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

6 participants