-
Notifications
You must be signed in to change notification settings - Fork 4k
Firebase messaging-handle background message in kotlin with MainActivity file #1906
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
Comments
Hi @msarkrish Closing, as this isn't an issue with FlutterFire itself, |
package io.flutter.plugins.firebasemessagingexample
import io.flutter.app.FlutterApplication
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
import io.flutter.plugins.GeneratedPluginRegistrant
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
class Application : FlutterApplication(), PluginRegistrantCallback {
override fun onCreate() {
super.onCreate()
FlutterFirebaseMessagingService.setPluginRegistrant(this)
}
override fun registerWith(registry: PluginRegistry?) {
GeneratedPluginRegistrant.registerWith(registry)
}
} |
Could everyone who still has this problem please file a new issue with the exact descriptions what happens, logs and the output of 'flutter doctor -v' please. |
This isn't a bug but it is a documentation request for implementing this using Kotlin instead of java since Android is moving away from java development. I'm having the same issue. |
I agree, the documentation could be better and I can't seem to find anything in the community or SO. |
Hi all, I had the same issue in my flutter project. However, when I created an Application.kt file and pasted the code from the README, the Kotlin plugin in IntelliJ automatically prompted to covert the Java code to Kotlin for me: The result was as follows. I simply had to add the override keywords Hope this helps! |
I'm using firebase_messaging in my flutter application.
To handle background messages with firebase messaging in pub they suggested to create new Application.java file and replace java file name in AndroidManifest file.
In my application i'm using kotlin and i already implemented some native code in MainActivity.kt
So how to write this code in kotlin.
it is mandatory to replace MainActivity to Application in AndroidManifest file? because i'm having some native code in MainActivity file
The text was updated successfully, but these errors were encountered: