final _localNotifications = FlutterLocalNotificationsPlugin();
final androidPlugin = _localNotifications.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>();
final allChannels = await androidPlugin?.getNotificationChannels();
results in the following exception
PlatformException(getNotificationChannelsError, Attempt to invoke virtual method 'int android.media.AudioAttributes.getUsage()' on a null object reference, java.lang.NullPointerException: Attempt to invoke virtual method 'int android.media.AudioAttributes.getUsage()' on a null object reference
at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.getMappedNotificationChannel(FlutterLocalNotificationsPlugin.java:265)
at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.getNotificationChannels(FlutterLocalNotificationsPlugin.java:32)
at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:399)
at me.j$a.a(MethodChannel.java:18)
at ae.c.l(DartMessenger.java:19)
at ae.c.m(DartMessenger.java:42)
at ae.c.h(Unknown Source:0)
at ae.b.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8826)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
, null)
To Reproduce
Unfortunately, we're seeing this only in production without any actionable reproduction steps.
The app is in foreground and active, though.
Expected behavior
I expect no exception to be thrown.
Describe the bug
The following code
results in the following exception
To Reproduce Unfortunately, we're seeing this only in production without any actionable reproduction steps. The app is in foreground and active, though.
Expected behavior I expect no exception to be thrown.
Sample code to reproduce the problem See above
This is not a duplicate of https://github.com/MaikuB/flutter_local_notifications/issues/2309 but it's pretty similar.