Closed JmyW closed 3 years ago
HI @JmyW I got the same issue. But I resolved this issue. I only add this method to Application.kt
FlutterAppBadgerPlugin.registerWith(registry!!.registrarFor("fr.g123k.flutterappbadger"))
and also added this import to Kotlin file
import fr.g123k.flutterappbadger.FlutterAppBadgerPlugin
And it works for me
Can you pls show your full application.kt and mainactivity.kt files ? thanks
@PavlyukovYegor Thank you so much! Yes, it works, now I can change the app badge onBackgroundMessage. Sorry for my late response since my project got serious architecture change. I did full dedication in past 2 weeks. Anyways, thanks again for help. @jenniestrongbow Thanks for asking, Pavlyukov's solution in Application.java solved my problem.
hey all. where is the Application.kt file?
@goldenmoon67 You need to create by yourself with manifest declaration. However the latest version of flutter_app_badge has no longer need this change. You just call it in onBackgroundMessage, it works great!
Hi I'm adopting the latest version 1.1.2. It works in normal implementation on my Android device. But if I add the code into FCM onBackgroundMessage, it generate the error "MissingPluginException(No implementation found for method updateBadgeCount on channel g123k/flutter_app_badger)".
This is different with the issue #13 "https://github.com/g123k/flutter_app_badger/issues/13" I still try the issue #13 is recommended to do "flutter clean", "flutter pub get", of course, not help.
My error is about the plugin is not registered in Android due to the onBackgroundMessage is an isolate code, not depend on the base app. So, I believe there is something should be registered in Application.java. For example, for access SharedPreferences in onBackgroundMessage, we need to add SharedPreferencesPlugin.registerWith(registry.registrarFor("io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin")); but I have no idea for app_badge, what should be registerWith? Could you help?