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

Most upvoted comments

@ithustle It doesn’t make sense to have ic_logo_notification.png and ic_logo_notification@1.0.png at 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 😦