react-native-track-player: [Android] Custom notification icon does not appear in debug builds. (Works in release builds)
I’m using this code to show icon on notification but it does not show up.
TrackPlayer.setupPlayer();
TrackPlayer.updateOptions({
stopWithApp: true,
capabilities: [
TrackPlayer.CAPABILITY_PLAY,
TrackPlayer.CAPABILITY_PAUSE,
TrackPlayer.CAPABILITY_SKIP_TO_NEXT,
TrackPlayer.CAPABILITY_SKIP_TO_PREVIOUS,
TrackPlayer.CAPABILITY_STOP
],
compactCapabilities: [
TrackPlayer.CAPABILITY_PLAY,
TrackPlayer.CAPABILITY_PAUSE
],
icon: require('./../imgs/ic_logo_notification.png'),
});```
Am I doing something wrong?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 32 (17 by maintainers)
Commits related to this issue
- [docs] Added a note for custom icons in debug mode #475 — committed to doublesymmetry/react-native-track-player by Guichaguri 4 years ago
- Merge branch 'dev' of github.com:react-native-kit/react-native-track-player into v1.2.x-curious * 'dev' of github.com:react-native-kit/react-native-track-player: (39 commits) [iOS] Add missing impo... — committed to curiousdustin/react-native-track-player by curiousdustin 4 years ago
- Merge commit 'd6e26a4b27f4bb6a5a1dbfb67407d165a809439a' * commit 'd6e26a4b27f4bb6a5a1dbfb67407d165a809439a': (96 commits) [iOS] Add missing import. [iOS] Use React Native utility from RCTConvert ... — committed to soundgym/react-native-track-player by bang9 4 years ago
@ithustle It doesn’t make sense to have
ic_logo_notification.pngandic_logo_notification@1.0.pngat the same time.To follow Android specification more strictly, try this:
ic_logo_notification.png- 24x24 px (mdpi)ic_logo_notification@1.5x.png- 36x36 px (hdpi)ic_logo_notification@2x.png- 48x48 px (xhdpi)ic_logo_notification@3x.png- 72x72 px (xxhdpi)ic_logo_notification@4x.png- 96x96 px (xxxhdpi)Since Android 5, your icon should have transparent background and be entirely white. You can use this tool to generate the image files: https://romannurik.github.io/AndroidAssetStudio/icons-notification.html
I removed the question label because I consider this a confirmed bug at this point. Custom icon does not appear in debug builds.
I was facing the same problem. It seems that while developing it will only display the default play icon, but with the release build installed (
gradlew installRelease), it gave me my desired notification icon.(I’m on RN 0.60.5 and version 1.1.8 of this package)
@Guichaguri… well, this is awkward but still no working 😦