diff --git a/android/app/src/main/kotlin/com/example/background/MainActivity.kt b/android/app/src/main/kotlin/com/example/background/MainActivity.kt index 7fdee61..7cf0083 100644 --- a/android/app/src/main/kotlin/com/example/background/MainActivity.kt +++ b/android/app/src/main/kotlin/com/example/background/MainActivity.kt @@ -19,7 +19,10 @@ class MainActivity : FlutterActivity() { MethodChannel(binaryMessenger, "com.example/background_service").apply { setMethodCallHandler { method, result -> if (method.method == "startService") { - val callbackRawHandle = method.arguments as Long + val callbackRawHandle = if (method.arguments is Long) + method.arguments as Long + else + (method.arguments as Int).toLong() // flutter build apk --obfuscate BackgroundService.startService(this@MainActivity, callbackRawHandle) result.success(null) } else {