-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
good first issueGood for newcomersGood for newcomersplugin: messagingtype: documentationImprovements or additions to documentationImprovements or additions to documentation
Description
For new projects with Kotlin support, the project only contains MainActivity.kt and not Java, and as for now, docs doesn't support it.

I suggest adding the following to GettingStarted.
Kotlin's support.
2. Add an Application.kt class to your app in the same directory as your MainActivity.kt. This is typically found in <app-name>/android/app/src/main/kotlin/<app-organization-path>/ .
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?) {
io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
}
}
- In Application.kt, make sure to change the package
io.flutter.plugins.firebasemessagingexampleto your package's identifier. Your package's identifier should be something likecom.domain.myapplication.
package com.domain.myapplication;
WaleedAlrashed, ronpetit, kartercs, jtpdev, dbbd59 and 8 more
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomersplugin: messagingtype: documentationImprovements or additions to documentationImprovements or additions to documentation