Skip to content
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

androidConfig closes the application #2

Closed
mrbreyner opened this issue Dec 1, 2020 · 6 comments
Closed

androidConfig closes the application #2

mrbreyner opened this issue Dec 1, 2020 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@mrbreyner
Copy link

hi, i decided to try your plugin and it worked fine, but when i call androidConfig initializer, the application closes instantly, however if i don't use androidConfig, everything works fine.

excuse my English 😁

@JulianAssmann
Copy link
Owner

Thank you for the bug report, I will look into it.

@JulianAssmann JulianAssmann added the bug Something isn't working label Dec 1, 2020
@JulianAssmann JulianAssmann self-assigned this Dec 1, 2020
@adinortey360
Copy link

hi, i decided to try your plugin and it worked fine, but when i call androidConfig initializer, the application closes instantly, however if i don't use androidConfig, everything works fine.

excuse my English 😁

This is the case for me too.
Actually, It causes my app to crash after the phone is restarted. It works fine even with androidConfig initialized for the first time the app is run then after the phone is restarted or sometimes when the app is restarted the crash begins.

@JulianAssmann
Copy link
Owner

Thank you very much for the report. Does it crash with an error message in the console? If so, providing that would be very helpful.

@JulianAssmann
Copy link
Owner

The issues should now be resolved with this commit, corresponding to version 0.1.2. Please let me know, if this fixes the problem for you.

@JulianAssmann
Copy link
Owner

I just encountered the same problem again with the example app, so I'm reopening this issue.

The error:

E/flutter ( 7094): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Unhandled error PlatformException(PermissionError, The battery optimizations are not turned off., , null) occurred in Instance of 'TcpClientBloc'.
E/flutter ( 7094): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:582:7)
E/flutter ( 7094): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:18)
E/flutter ( 7094): <asynchronous suspension>
E/flutter ( 7094): #2      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:332:12)
E/flutter ( 7094): #3      FlutterBackground.enableBackgroundExecution (package:flutter_background/src/flutter_background.dart:45:29)
E/flutter ( 7094): #4      TcpClientBloc._mapConnectToState (package:flutter_background_example/bloc/tcp_client_bloc/tcp_client_bloc.dart:46:59)
E/flutter ( 7094): <asynchronous suspension>
E/flutter ( 7094): #5      TcpClientBloc.mapEventToState (package:flutter_background_example/bloc/tcp_client_bloc/tcp_client_bloc.dart:24:14)
E/flutter ( 7094): <asynchronous suspension>
E/flutter ( 7094): #6      Bloc._bindEventsToStates.<anonymous closure> (package:bloc/src/bloc.dart:231:20)
E/flutter ( 7094): #7      Stream.asyncExpand.<anonymous closure>.<anonymous closure> (dart:async/stream.dart:644:30)
E/flutter ( 7094): #8      _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter ( 7094): #9      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter ( 7094): #10     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter ( 7094): #11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
E/flutter ( 7094): #12     _DelayedData.perform (dart:async/stream_impl.dart:611:14)
E/flutter ( 7094): #13     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:730:11)
E/flutter ( 7094): #14     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:687:7)
E/flutter ( 7094): #15     _rootRun (dart:async/zone.dart:1182:47)
E/flutter ( 7094): #16     _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter ( 7094): #17     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter ( 7094): #18     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
E/flutter ( 7094): #19     _rootRun (dart:async/zone.dart:1190:13)
E/flutter ( 7094): #20     _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter ( 7094): #21     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter ( 7094): #22     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
E/flutter ( 7094): #23     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 7094): #24     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter ( 7094): 
E/flutter ( 7094): #0      Cubit.onError.<anonymous closure> (package:bloc/src/cubit.dart:144:7)
E/flutter ( 7094): #1      Cubit.onError (package:bloc/src/cubit.dart:145:6)
E/flutter ( 7094): #2      Bloc.onError (package:bloc/src/bloc.dart:201:11)
E/flutter ( 7094): #3      _rootRunBinary (dart:async/zone.dart:1214:47)
E/flutter ( 7094): #4      _CustomZone.runBinary (dart:async/zone.dart:1107:19)
E/flutter ( 7094): #5      _CustomZone.runBinaryGuarded (dart:async/zone.dart:1013:7)
E/flutter ( 7094): #6      _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:376:15)
E/flutter ( 7094): #7      _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:394:16)
E/flutter ( 7094): #8      _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:294:7)
E/flutter ( 7094): #9      _SyncBroadcastStreamController._sendError.<anonymous closure> (dart:async/broadcast_stream_controller.dart:400:20)
E/flutter ( 7094): #10     _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:330:15)
E/flutter ( 7094): #11     _SyncBroadcastStreamController._sendError (dart:async/broadcast_stream_controller.dart:399:5)
E/flutter ( 7094): #12     _BroadcastStreamController._addError (dart:async/broadcast_stream_controller.dart:297:5)
E/flutter ( 7094): #13     _rootRunBinary (dart:async/zone.dart:1214:47)
E/flutter ( 7094): #14     _CustomZone.runBinary (dart:async/zone.dart:1107:19)
E/flutter ( 7094): #15     _CustomZone.runBinaryGuarded (dart:async/zone.dart:1013:7)
E/flutter ( 7094): #16     _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:376:15)
E/flutter ( 7094): #17     _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:394:16)
E/flutter ( 7094): #18     _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:294:7)
E/flutter ( 7094): #19     _ForwardingStreamSubscription._addError (dart:async/stream_pipe.dart:132:11)
E/flutter ( 7094): #20     _ForwardingStream._handleError (dart:async/stream_pipe.dart:97:10)
E/flutter ( 7094): #21     _ForwardingStreamSubscription._handleError (dart:async/stream_pipe.dart:161:13)
E/flutter ( 7094): #22     _rootRunBinary (dart:async/zone.dart:1214:47)
E/flutter ( 7094): #23     _CustomZone.runBinary (dart:async/zone.dart:1107:19)
E/flutter ( 7094): #24     _CustomZone.runBinaryGuarded (dart:async/zone.dart:1013:7)
E/flutter ( 7094): #25     _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:376:15)
E/flutter ( 7094): #26     _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:394:16)
E/flutter ( 7094): #27     _DelayedError.perform (dart:async/stream_impl.dart:622:14)
E/flutter ( 7094): #28     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:730:11)
E/flutter ( 7094): #29     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:687:7)
E/flutter ( 7094): #30     _rootRun (dart:async/zone.dart:1182:47)
E/flutter ( 7094): #31     _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter ( 7094): #32     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter ( 7094): #33     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
E/flutter ( 7094): #34     _rootRun (dart:async/zone.dart:1190:13)
E/flutter ( 7094): #35     _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter ( 7094): #36     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter ( 7094): #37     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
E/flutter ( 7094): #38     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 7094): #39     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter ( 7094): 
D/AndroidRuntime( 7094): Shutting down VM
E/AndroidRuntime( 7094): FATAL EXCEPTION: main
E/AndroidRuntime( 7094): Process: de.julianassmann.flutter_background_example, PID: 7094
E/AndroidRuntime( 7094): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=5672353, result=-1, data=null} to activity {de.julianassmann.flutter_background_example/de.julianassmann.flutter_background_example.MainActivity}: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime( 7094):        at android.app.ActivityThread.deliverResults(ActivityThread.java:5009)
E/AndroidRuntime( 7094):        at android.app.ActivityThread.handleSendResult(ActivityThread.java:5050)
E/AndroidRuntime( 7094):        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
E/AndroidRuntime( 7094):        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime( 7094):        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime( 7094):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
E/AndroidRuntime( 7094):        at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 7094):        at android.os.Looper.loop(Looper.java:223)
E/AndroidRuntime( 7094):        at android.app.ActivityThread.main(ActivityThread.java:7660)
E/AndroidRuntime( 7094):        at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 7094):        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime( 7094):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/AndroidRuntime( 7094): Caused by: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime( 7094):        at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:139)
E/AndroidRuntime( 7094):        at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:238)
E/AndroidRuntime( 7094):        at de.julianassmann.flutter_background.PermissionHandler$requestBatteryOptimizationsOff$1.invoke(PermissionHandler.kt:62)
E/AndroidRuntime( 7094):        at de.julianassmann.flutter_background.PermissionHandler$requestBatteryOptimizationsOff$1.invoke(PermissionHandler.kt:15)
E/AndroidRuntime( 7094):        at de.julianassmann.flutter_background.PermissionActivityResultListener.onActivityResult(PermissionHandler.kt:86)
E/AndroidRuntime( 7094):        at io.flutter.embedding.engine.FlutterEnginePluginRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEnginePluginRegistry.java:691)
E/AndroidRuntime( 7094):        at io.flutter.embedding.engine.FlutterEnginePluginRegistry.onActivityResult(FlutterEnginePluginRegistry.java:378)
E/AndroidRuntime( 7094):        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:625)
E/AndroidRuntime( 7094):        at io.flutter.embedding.android.FlutterActivity.onActivityResult(FlutterActivity.java:583)
E/AndroidRuntime( 7094):        at android.app.Activity.dispatchActivityResult(Activity.java:8310)
E/AndroidRuntime( 7094):        at android.app.ActivityThread.deliverResults(ActivityThread.java:5002)
E/AndroidRuntime( 7094):        ... 11 more
I/Process ( 7094): Sending signal. PID: 7094 SIG: 9

@JulianAssmann
Copy link
Owner

This should now be resolved by PR #12
I will close this issue, but if the bug persits, please don't hesitate to reopen it and let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants