-
Notifications
You must be signed in to change notification settings - Fork 8
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
Plugin doesn't work with mainactivity.kt #2
Comments
Ditto, any suggestions? |
So, I'm try to use this package but now it's to difficult to find the key to register a new package, because they doesn't show in the generatedpluginregistrant file by the way, probably this it's the kotlin file package change.this.withyourprojectname
import androidx.annotation.NonNull
import androidx.arch.core.util.Function
import dev.thinkng.flt_worker.FltWorkerPlugin.*
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
FltWorkerPlugin.registerPluginsForWorkers = Function { registry: PluginRegistry ->
io.flutter.plugins.pathprovider.PathProviderPlugin.registerWith(
registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin"))
//// If you need to add another package
//// io.flutter.plugins.pathprovider.PathProviderPlugin.registerWith(
//// registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin"))
null
}
}
} |
Has anyone managed to make this work with kotlin? |
@hectorAguero have you got a solution? Can i just register all plugins for the background task? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it appears that the plugin does not work when the flutter app uses a kotlin based main activity.
I followed the example and modified the java code to meet the Kotlin syntax but was met with an error saying that it expected a function in java form, not kotlin.
The text was updated successfully, but these errors were encountered: