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

Nullpointer exception while showing the notification. #1905

Closed
waqashussain-dev opened this issue Feb 27, 2023 · 1 comment
Closed

Nullpointer exception while showing the notification. #1905

waqashussain-dev opened this issue Feb 27, 2023 · 1 comment

Comments

@waqashussain-dev
Copy link

Getting nullpointer exception while showing the notification:
I/flutter ( 7621): PlatformException(error, Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
I/flutter ( 7621): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.setSmallIcon(FlutterLocalNotificationsPlugin.java:425)
I/flutter ( 7621): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:326)
I/flutter ( 7621): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:1146)
I/flutter ( 7621): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:1462)
I/flutter ( 7621): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:1299)
I/flutter ( 7621): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
I/flutter ( 7621): at io
I/flutter ( 7621): #0 StandardMethodCodec.decodeEnvelope
message_codecs.dart:653
I/flutter ( 7621): #1 MethodChannel._invokeMethod
platform_channel.dart:315
I/flutter ( 7621):
I/flutter ( 7621): #2 FlutterLocalNotificationsPlugin.show
flutter_local_notifications_plugin.dart:239

showing the notification by below mentioned code
AndroidNotificationDetails androidNotificationDetails =
AndroidNotificationDetails(
color: Colors.blue,
channel.id,
channel.name,
channelDescription: APPConstants.firebaseNotificationChannelDescription,
importance: Importance.max,
priority: Priority.high,
ticker: 'ticker',
);
NotificationDetails notificationDetails =
NotificationDetails(android: androidNotificationDetails);
// flutterLocalNotificationsPlugin.show(notification.hashCode,
// notification.title, notification.body, notificationDetails);
flutterLocalNotificationsPlugin.show(
1, 'notification', 'plain body', notificationDetails,
payload: 'item x');
}

@MaikuB
Copy link
Owner

MaikuB commented Mar 8, 2023

The error would be indicative of not having specialised the notification icon correctly by having an appropriate drawable source and specify the name of said resource that is typically by calling the initialize API and specifying the default icon for all notifications. Please check that you have done this. If you believe you have then please provide a link to a repository hosting a minimal app that can reproduce the issue

@MaikuB MaikuB closed this as completed Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants