VNAPNIC / flutter_nearby_connections

Flutter plugin support peer-to-peer connectivity and the discovery of nearby devices for Android vs IOS
https://pub.dev/packages/flutter_nearby_connections
BSD 2-Clause "Simplified" License
109 stars 72 forks source link

Running as a Foreground Task #46

Open csnaasim opened 1 year ago

csnaasim commented 1 year ago

We are in a scenerio where we need to implement this plugin in a foreground service combined with another flutter plugin. flutter_foreground_task On try to start discovery we are getting following errors

E/MethodChannel#nearby_connections( 5496): Failed to handle method call E/MethodChannel#nearby_connections( 5496): java.lang.NullPointerException: Activity must not be null E/MethodChannel#nearby_connections( 5496): at e.a.a.a.b.k.o.g(:11) E/MethodChannel#nearby_connections( 5496): at e.a.a.a.f.a.a(:1) E/MethodChannel#nearby_connections( 5496): at e.b.a.b.onMethodCall(:233) E/MethodChannel#nearby_connections( 5496): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(:262) E/MethodChannel#nearby_connections( 5496): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(:295) E/MethodChannel#nearby_connections( 5496): at io.flutter.embedding.engine.dart.DartMessenger.a(:319) E/MethodChannel#nearby_connections( 5496): at io.flutter.embedding.engine.dart.DartMessenger.b(Unknown Source:0) E/MethodChannel#nearby_connections( 5496): at f.a.a.b.b.c.run(Unknown Source:12) E/MethodChannel#nearby_connections( 5496): at android.os.Handler.handleCallback(Handler.java:938) E/MethodChannel#nearby_connections( 5496): at android.os.Handler.dispatchMessage(Handler.java:99) E/MethodChannel#nearby_connections( 5496): at android.os.Looper.loopOnce(Looper.java:226) E/MethodChannel#nearby_connections( 5496): at android.os.Looper.loop(Looper.java:313) E/MethodChannel#nearby_connections( 5496): at android.app.ActivityThread.main(ActivityThread.java:8751) E/MethodChannel#nearby_connections( 5496): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#nearby_connections( 5496): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) E/MethodChannel#nearby_connections( 5496): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)