JulianAssmann / flutter_background

A flutter plugin to keep apps running in the background via foreground services. Android only.
https://pub.dev/packages/flutter_background
MIT License
88 stars 51 forks source link

Failed to handle method call #70

Open Ckc1124 opened 1 year ago

Ckc1124 commented 1 year ago

my code: image

version: 0.1.6

issue E/MethodChannel#flutter_background( 9919): Failed to handle method call E/MethodChannel#flutter_background( 9919): kotlin.KotlinNullPointerException E/MethodChannel#flutter_background( 9919): at de.julianassmann.flutter_background.FlutterBackgroundPlugin.onMethodCall(FlutterBackgroundPlugin.kt:67) E/MethodChannel#flutter_background( 9919): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:230) E/MethodChannel#flutter_background( 9919): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) E/MethodChannel#flutter_background( 9919): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692) E/MethodChannel#flutter_background( 9919): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#flutter_background( 9919): at android.os.MessageQueue.next(MessageQueue.java:335) E/MethodChannel#flutter_background( 9919): at android.os.Looper.loop(Looper.java:183) E/MethodChannel#flutter_background( 9919): at android.app.ActivityThread.main(ActivityThread.java:7697) E/MethodChannel#flutter_background( 9919): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#flutter_background( 9919): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) E/MethodChannel#flutter_background( 9919): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952) E/flutter ( 9919): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: PlatformException(error, null, null) E/flutter ( 9919): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:572:7) E/flutter ( 9919): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:161:18) E/flutter ( 9919): E/flutter ( 9919): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:334:12) E/flutter ( 9919): #3 FlutterBackground.hasPermissions (package:flutter_background/src/flutter_background.dart:37:27) E/flutter ( 9919): #4 _ModuleSelectMainPageState.build.. (package:FlutterApp/common/widget/module_select_main_page.dart:209:71) E/flutter ( 9919): #5 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:992:19) E/flutter ( 9919): #6 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:1098:38) E/flutter ( 9919): #7 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:184:24) E/flutter ( 9919): #8 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:524:11) E/flutter ( 9919): #9 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:284:5) E/flutter ( 9919): #10 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:219:7) E/flutter ( 9919): #11 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:477:9) E/flutter ( 9919): #12 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:78:12) E/flutter ( 9919): #13 PointerRouter._dispatchEventToRoutes. (package:flutter/src/gestures/pointer_router.dart:124:9) E/flutter ( 9919): #14 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8) E/flutter ( 9919): #15 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:122:18) E/flutter ( 9919): #16 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:108:7) E/flutter ( 9919): #17 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:220:19) E/flutter ( 9919): #18 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:200:22) E/flutter ( 9919): #19 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:158:7) E/flutter ( 9919): #20 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:104:7) E/flutter ( 9919): #21 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:88:7) E/flutter ( 9919): #22 _rootRunUnary (dart:async/zone.dart:1206:13) E/flutter ( 9919): #23 _CustomZone.runUnary (dart:async/zone.dart:1100:19) E/flutter ( 9919): #24 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7) E/flutter ( 9919): #25 _invoke1 (dart:ui/hooks.dart:267:10) E/flutter ( 9919): #26 _dispatchPointerDataPacket (dart:ui/hooks.dart:176:5) E/flutter ( 9919):

binvb commented 1 year ago

same error, any update?

Muhammad-Mohsen commented 1 year ago

I think this is related to #69 I'd try the solution by @jakoss to add the service to the AndroidManifset manually

<service android:name="de.julianassmann.flutter_background.IsolateHolderService" android:exported="false" />

vmwsree commented 1 year ago

I added still no notification icon

jakoss commented 1 year ago

I added still no notification icon

Are you on Android 13?

JulianAssmann commented 2 months ago

Thanks for creating the issue. Can you please upgrade to the new version of the plugin (1.3.0), update your AndroidManifest.xml according to the new README (specifically including the foreground service types) and report back?