Skip to content

fix: A bug fix #592

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package dev.fluttercommunity.workmanager

import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.embedding.engine.plugins.activity.ActivityAware
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
import android.content.Context
import android.os.Handler
import android.os.Looper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ package dev.fluttercommunity.workmanager
import android.content.Context
import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
import io.flutter.plugin.common.MethodChannel.Result

class WorkmanagerPlugin : FlutterPlugin {
class WorkmanagerPlugin : FlutterPlugin, MethodCallHandler {
private var methodChannel: MethodChannel? = null
private var workmanagerCallHandler: WorkmanagerCallHandler? = null

Expand All @@ -19,7 +22,11 @@ class WorkmanagerPlugin : FlutterPlugin {
) {
workmanagerCallHandler = WorkmanagerCallHandler(context)
methodChannel = MethodChannel(messenger, "be.tramckrijte.workmanager/foreground_channel_work_manager")
methodChannel?.setMethodCallHandler(workmanagerCallHandler)
methodChannel?.setMethodCallHandler(this)
}

override fun onMethodCall(call: MethodCall, result: Result) {
workmanagerCallHandler?.handle(call, result)
}

override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
Expand All @@ -31,4 +38,4 @@ class WorkmanagerPlugin : FlutterPlugin {
methodChannel = null
workmanagerCallHandler = null
}
}
}
2 changes: 1 addition & 1 deletion workmanager/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: workmanager
description: Flutter Workmanager. This plugin allows you to schedule background work on Android and iOS.
version: 0.5.2
version: 0.5.3
homepage: https://github.com/fluttercommunity/flutter_workmanager
repository: https://github.com/fluttercommunity/flutter_workmanager
issue_tracker: https://github.com/fluttercommunity/flutter_workmanager/issues
Expand Down
Loading