Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception while trying to read notification channels #2318

Closed
ueman opened this issue May 6, 2024 · 1 comment · Fixed by #2319
Closed

Exception while trying to read notification channels #2318

ueman opened this issue May 6, 2024 · 1 comment · Fixed by #2319

Comments

@ueman
Copy link
Contributor

ueman commented May 6, 2024

Describe the bug

The following code

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.

Sample code to reproduce the problem
See above

This is not a duplicate of #2309 but it's pretty similar.

@MaikuB
Copy link
Owner

MaikuB commented May 6, 2024

Thanks for raising. Fix has been published in version 17.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants