I am trying to setup FCM (Firebase Cloud Messaging) on my newly created flutter project to enable Background messaging. I am following the instructions at the bottom of this page https://pub.dev/packages/firebase_messaging to "Handle background Messages"
The only problem is that on step 2, It requires me to add a Application.java class to the file android/app/src/main/java/<app-organization-path>/MainActivity.java.
This seems fairly straight forward bu this file does not exist for me. Instead it is in the android/app/src/main/kotlin/ folder and the file is MainActivity.kt
My question is how do I convert this code: (directly taken from the page)
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;
public class Application extends FlutterApplication implements PluginRegistrantCallback {
@Override
public void onCreate() {
super.onCreate();
FlutterFirebaseMessagingService.setPluginRegistrant(this);
}
@Override
public void registerWith(PluginRegistry registry) {
GeneratedPluginRegistrant.registerWith(registry);
}
}
and convert it to kotlin?