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

Flutter Foreground Notification (Android Emulator) #1168

Closed
mado-bohsali opened this issue May 17, 2021 · 7 comments
Closed

Flutter Foreground Notification (Android Emulator) #1168

mado-bohsali opened this issue May 17, 2021 · 7 comments

Comments

@mado-bohsali
Copy link

For Android emulators, once I receive a foreground notification a stack trace appears in my console:

D/FLTFireMsgReceiver( 7010): broadcast received for message
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): Failed to handle method call
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.setSmallIcon(FlutterLocalNotificationsPlugin.java:237)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:179)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:791)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:1054)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:947)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at android.os.MessageQueue.next(MessageQueue.java:335)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at android.os.Looper.loop(Looper.java:183)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/MethodChannel#dexterous.com/flutter/local_notifications( 7010): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter ( 7010): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: 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
E/flutter ( 7010): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.setSmallIcon(FlutterLocalNotificationsPlugin.java:237)
E/flutter ( 7010): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:179)
E/flutter ( 7010): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:791)
E/flutter ( 7010): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:1054)
E/flutter ( 7010): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:947)
E/flutter ( 7010): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter ( 7010): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/flutter ( 7010): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/flutter ( 7010): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter ( 7010): at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter ( 7010): at android.os.Looper.loop(Looper.java:183)
E/flutter ( 7010): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter ( 7010): at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 7010): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter ( 7010): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter ( 7010): )
E/flutter ( 7010): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:581:7)
E/flutter ( 7010): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
E/flutter ( 7010):
E/flutter ( 7010): #2 FlutterLocalNotificationsPlugin.show (package:flutter_local_notifications/src/flutter_local_notifications_plugin.dart:179:7)
E/flutter ( 7010):
E/flutter ( 7010):

@MaikuB
Copy link
Owner

MaikuB commented May 17, 2021

You've likely not specified the icon that should be used correctly, please cross-reference what you've done with what's in the docs and the example app

@mado-bohsali
Copy link
Author

I still receive the message:
broadcast received for message

@MaikuB
Copy link
Owner

MaikuB commented May 17, 2021

There's not much else I can tell you as there aren't any known issues with around showing this so you'll need to either take a closer look or have someone check the work you've done

@mado-bohsali
Copy link
Author

May you have a look?

@mado-bohsali
Copy link
Author

What firebase pub.dev versions are you using?

@MaikuB
Copy link
Owner

MaikuB commented May 19, 2021

May you have a look?

As this is something I do in my spare time and there are fewer contributors, If you need someone to take a look then you'd need to reach out to wider community.

What firebase pub.dev versions are you using?

The version of firebase isn't relevant to the error (note: i'm not using it either), if you stripped the away the code to just show a notification using only this plugin then you should run into the same issue. As mentioned before, the issue you see happens when the icon hasn't been configured correctly so you'll need to take a closer look at how you've done so. This requires knowledge on how Android manages resources to ensure you put it the image in the right location and specify it correctly. If you are using FCM, note that they have an example app that uses the plugin together with this one as well. You can clone the repo and look at the example app associated with this plugin and run it as well

@mado-bohsali
Copy link
Author

mado-bohsali commented May 29, 2021 via email

@MaikuB MaikuB closed this as completed Jun 18, 2021
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