transistorsoft/flutter_background_geolocation

bg.Notification( ) => Failed to find icons.

Closed this issue · 4 comments

Your Environment

  • Plugin version: Latest
  • Platform: iOS or Android: Android
  • OS version:
  • Device manufacturer / model:
  • Flutter info (flutter doctor):
  • Plugin config:
PASTE_YOUR_CODE_HERE

Expected Behavior

Expecting to not get error.

Actual Behavior

Expecting to not get error.

Steps to Reproduce

  1. Use code snippet above, you get the error.

Context

Setup large and small icons for bg.notification.

Debug logs

Logs
PASTE_YOUR_LOGS_HERE

notification: bg.Notification(
title: "Stop2Stop",
text: "Recieving location updates.",
// color: "#ff0000",
largeIcon: 'ic_launcher.png',
smallIcon: 'ic_launcher.png',
channelName: "alerts",
),

Above code snippet is not working.. I get the following error.
E/2APPNAME( 6324): Invalid ID 0x00000000.
W/TSLocationManager( 6324): [c.t.l.s.ForegroundNotification b] Failed to find notificationLargeIcon: ic_launcher.png

ic_launcher.png exists. I also tried with largeIcon: 'mipmap-xxxhdpi\ic_launcher.png', option. it does not work.

Please advise.

What do the examples in the api docs show you?

adding the file extension .png is a mistake, for one thing.

Thanks! With following, not getting the error anymore.

  • smallIcon: 'drawable/ic_launcher_small',
  • largeIcon: 'drawable/ic_launcher_large',

following did not work for some reason..

  • largeIcon: 'mipmap-xhdpi/ic_launcher',

following did not work for some reason..

Of course it didn’t work. The resolution (eg xhdpi) is automatically chosen depending on the device capability.