Almoullim / background_location

Flutter background location plugin for Android and iOS
https://pub.dev/packages/background_location
Other
224 stars 236 forks source link

Not work when app killed #92

Closed erayhamurlu closed 3 years ago

erayhamurlu commented 3 years ago

not work when app killed

DedSecTeam17 commented 3 years ago

Ios or android ??

savassuphan commented 3 years ago

evet bendede bu hatayı veriyor W/FlutterJNI(30740): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: almoullim.com/background_location. Response ID: 0

olofumark commented 3 years ago

Same issue. Not working when app killed. Android & Ios

lunar82 commented 3 years ago

If that helps, here's the console log when killing an app on the device (android 10.0):

E/ActivityThread(13770): Activity com.example.flutter_application_1.MainActivity has leaked ServiceConnection com.almoullim.background_location.BackgroundLocationPlugin$mServiceConnection$1@e72e099 that was originally bound here E/ActivityThread(13770): android.app.ServiceConnectionLeaked: Activity com.example.flutter_application_1.MainActivity has leaked ServiceConnection com.almoullim.background_location.BackgroundLocationPlugin$mServiceConnection$1@e72e099 that was originally bound here E/ActivityThread(13770): at android.app.LoadedApk$ServiceDispatcher.(LoadedApk.java:1805) E/ActivityThread(13770): at android.app.LoadedApk.getServiceDispatcherCommon(LoadedApk.java:1677) E/ActivityThread(13770): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1656) E/ActivityThread(13770): at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1721) E/ActivityThread(13770): at android.app.ContextImpl.bindService(ContextImpl.java:1650) E/ActivityThread(13770): at android.content.ContextWrapper.bindService(ContextWrapper.java:705) E/ActivityThread(13770): at com.almoullim.background_location.BackgroundLocationPlugin.onMethodCall(BackgroundLocationPlugin.kt:82) E/ActivityThread(13770): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) E/ActivityThread(13770): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) E/ActivityThread(13770): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818) E/ActivityThread(13770): at android.os.MessageQueue.nativePollOnce(Native Method) E/ActivityThread(13770): at android.os.MessageQueue.next(MessageQueue.java:336) E/ActivityThread(13770): at android.os.Looper.loop(Looper.java:174) E/ActivityThread(13770): at android.app.ActivityThread.main(ActivityThread.java:7356) E/ActivityThread(13770): at java.lang.reflect.Method.invoke(Native Method) E/ActivityThread(13770): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) E/ActivityThread(13770): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

schnphil commented 3 years ago

Anyone found a solution ?

MoralCode commented 3 years ago

I don't believe there are currently any ways for a native iOS or Android app to get the users location after it has been quit or fully closed by the user. Flutter is not able to do anything more than can be done natively in Android and iOS, so I don't believe this is ever going to be possible.

schnphil commented 3 years ago

iOS Apps and Android Apps definitely Get locations after being terminated. There are APIs for that case. I ended up using a different pub and made sure the system specific APIs work led correctly

MoralCode commented 3 years ago

iOS Apps and Android Apps definitely Get locations after being terminated

Do you have links to where this is in the documentation? id love to learn how to do this too!

rrafush commented 3 years ago

same for me here, I'm trying to get the user's location even when the app is killed, has someone managed to do this?

rainaakshay commented 3 years ago

I have worked on native iOS apps that constantly supply locations in the background. The difference is, in the background/terminated state, we have to manually stop listening to locationUpdates, and start listening to significantLocationChanges. These will only trigger when the user moves approx. 500m. but it does the job with low battery consumption.

rainaakshay commented 3 years ago

@schnphil Could you tell me what pub you ended up using? I have a similar problem.

aea91 commented 2 years ago

evet bendede bu hatayı veriyor W/FlutterJNI(30740): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: almoullim.com/background_location. Response ID: 0

IOS arka planda app kill iken konum alıp server a istek atma işlemini yapabildiniz mi?