Skip to content

[Bug]: Invalid notification (no valid small icon) #1656

Closed
@Mojo1917

Description

@Mojo1917

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS
  • Linux
  • macOS
  • Web
  • Windows

Steps to reproduce

I am using the following settings to obtain the device's location:

return AndroidSettings(
          accuracy: LocationAccuracy.best,
          distanceFilter: 2,
          intervalDuration: const Duration(seconds: 2),
          foregroundNotificationConfig: ForegroundNotificationConfig(
            notificationChannelName:
                localizations.userRecordingNotificationTitle,
            notificationText: localizations.userRecordingNotificationText,
            notificationTitle: localizations.userRecordingNotificationTitle,
            enableWakeLock: false,
            setOngoing: true,
            notificationIcon: const AndroidResource(
                name: "ic_notification", defType: "drawable"),
          ));
  • The ic_notification asset is a 96x96 PNG image with an alpha channel.
  • The asset is placed directly in the drawable folder.

I found this related issue #1258

Expected results

  • The notification should be displayed correctly without causing an exception.
  • On my Pixel 5 test device, the notification appears as expected, and the icon is visible.

Actual results

  • A crash is reported with the following error message: PlatformException(error, Invalid notification (no valid small icon): Notification(channel=geolocator_channel_01 shortcut=null contentView=null vibrate=null sound=null defaults=0 flags=ONGOING_EVENT color=0x00000000 vis=PRIVATE), null, null). Error thrown .
  • Based on the Crashlytics report, it appears that Geolocator is using the fused location provider
  • The issue has been reported on a Pixel 9 device.

Code sample

For code, please see above. I am not able to reproduce the crash on my devices.

Screenshots or video

No response

Version

13.0.2

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.1, on macOS 15.3.1 24D70 darwin-arm64, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] VS Code (version 1.98.0)
[✓] Connected device (4 available)
[✓] Network resources

Metadata

Metadata

Assignees

Labels

status: needs more infoWe need more information before we can continue work on this issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions