question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Notification is not displaying the correct title, text and icon

See original GitHub issue

I am using the code from your example application, but the notification is not showing anything from notificationConfig. The title is testApp is running, message is Tap for more information or to stop the app and there is no icon at all.

Code snippet:

	startForegroundService = async () => {
		if (Platform.OS !== 'android') {
			console.log("Foreground service is available only on Android!");
			return;
		}

		if (Platform.Version >= 26) {
			const channelConfig = {
				id: 'ForegroundServiceChannel',
				name: 'Notification Channel',
				description: 'Notification Channel for Foreground Service',
				enableVibration: true,
				importance: 2
			};

			try {
				await VIForegroundService.createNotificationChannel(channelConfig);
			} catch (e) {
				console.log('HomePage', e);
			}
		}

		const notificationConfig = {
			channelId: 'ForegroundServiceChannel',
			id: 3456,
			title: 'MyTestApplication',
			text: 'Notification test text',
			icon: 'ic_notification',
			priority: 1
		};

		if (Platform.Version >= 26) {
			notificationConfig.channelId = 'ForegroundServiceChannel';
		}

		await VIForegroundService.startService(notificationConfig);
	}

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

6reactions
ipa127001commented, Jun 13, 2019

Add an icon with name ic_notification in resource of android.

5reactions
dkoo761commented, Jul 17, 2019

Thanks @ipa127001! To provide a bit more detail, I added my icon as an ic_notification.png file to the following directories which fixed all of the issues mentioned in this ticket:

/android/app/src/main/res/mipmap-hdpi /android/app/src/main/res/mipmap-mdpi /android/app/src/main/res/mipmap-xhdpi /android/app/src/main/res/mipmap-xxhdpi /android/app/src/main/res/mipmap-xxxhdpi

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Notification does not show the correct smallIcon?
First of all, Large icon and Small icon can be different. setSmallIcon() : sets an icon that should be displayed at status bar...
Read more >
RadNotification title icon and text randomly not working - Telerik
The content in the template area always appears correctly but title icon and text sometimes don't work and it appears to be happening...
Read more >
Notifications on your Apple Watch - Apple Support
Notifications appear on your Apple Watch or iPhone, but not both. ... the notifying app's name and icon along with the notification title....
Read more >
Displaying a Notification - web.dev
Notification with title and body text in Chrome on Linux. ... Expect your action icons not to be displayed at all. The Notification...
Read more >
Why does some text display with square boxes in some apps ...
Because the font that the app is trying to use is not present on the system, some other font gets used to display...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found