OneSignal / OneSignal-Flutter-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
https://www.onesignal.com
Other
606 stars 204 forks source link

[Bug]: addClickListener not triggered when app is killed #845

Open Debabrataroy opened 4 months ago

Debabrataroy commented 4 months ago

What happened?

OneSignal.Notifications.addClickListener does not fire on the push notification tap when the app is killed (android). Also, I run in release mode but the result is the same.

Here are the logs when I run in release mode. W/FlutterJNI(19398): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: OneSignal#notifications. Response ID: 35 W/FlutterJNI(19398): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: OneSignal#notifications. Response ID: 14 W/FlutterJNI(19398): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: OneSignal#notifications. Response ID: 9

Package Info: onesignal_flutter: dependency: "direct main" description: name: onesignal_flutter url: "https://pub.dev" source: hosted version: "5.1.0"

Let me know if you need anything else. Thanks

Steps to reproduce?

1. kill the app
2. click on the received notification

What did you expect to happen?

addClickListener should be triggered when app open

OneSignal Flutter SDK version

5.1.0

Which platform(s) are affected?

Relevant log output

No response

Code of Conduct

mwaqassatti commented 4 months ago

I'm also facing the same issue, did any one found the solution!

nan-li commented 3 months ago

Hi @Debabrataroy and @mwaqassatti thank you for reporting. You are seeing this "Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send" error every time notification is clicked from an app killed state? Or only sometimes?

Can you share your flutter doctor?

margherital commented 1 month ago

Hi @nan-li ! I am facing the same issue. I get the error you mentioned every time a notification is clicked from the app in killed state. If I kill the app again and send a new notification I get the same error multiple times.

This is what I got after 3 notifications:

W/FlutterJNI(11668): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: OneSignal#notifications. Response ID: 16 W/FlutterJNI(11668): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: OneSignal#notifications. Response ID: 17 W/FlutterJNI(11668): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: OneSignal#notifications. Response ID: 9 W/FlutterJNI(11668): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: OneSignal#notifications. Response ID: 18 W/FlutterJNI(11668): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: OneSignal#notifications. Response ID: 10 W/FlutterJNI(11668): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: OneSignal#notifications. Response ID: 9

This is my flutter doctor:

Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.19.6, on Microsoft Windows [Versione 10.0.22631.3593], locale it-IT) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.6.4) [√] Android Studio (version 2022.1) [√] VS Code (version 1.89.1) [√] Connected device (4 available) [√] Network resources

Do you have any updates?