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
623 stars 213 forks source link

[Bug]: MissingPluginException(No implementation found for method OneSignal#addNativeClickListener on channel OneSignal#notifications) #947

Closed hardiklakhalani closed 2 months ago

hardiklakhalani commented 2 months ago

What happened?

Latest version of SDK (^5.2..4) is throwing the following exception:

MissingPluginException(No implementation found for method OneSignal#addNativeClickListener on channel OneSignal#notifications)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:332:7)
I/flutter (17989): <asynchronous suspension>

Steps to reproduce?

1. Install ^5.2.4 for Android Platform
2. Implement the following after initialization:

OneSignal.Notifications.addClickListener((OSNotificationClickEvent result) async {
///
}

Before migration to v5, it was working fine:
`OneSignal.shared.setNotificationOpenedHandler(OSNotificationOpenedResult result) async { }`

3. Run the app in emulator, this error will occure.

What did you expect to happen?

I expected that method to have existed. If that doesn't exist then proper lint/syntax error should have thrown.

OneSignal Flutter SDK version

Release ^5.2.4

Flutter SDK version

Stable 3.19.6

Which platform(s) are affected?

Relevant log output

MissingPluginException(No implementation found for method OneSignal#addNativeClickListener on channel OneSignal#notifications)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:332:7)
I/flutter (17989): <asynchronous suspension>

Code of Conduct

hardiklakhalani commented 2 months ago

✅ in v3, it was working fine even before initializing onesignal, now after migrating to v5, it must be after initialization. Closing as resolved, i guess.