Closed shahmirzali49 closed 2 years ago
can you provide us with the smalles example possible where it is not working? Did you try the example project?
Yes, this is the example project. first I get LocationWhenInUse permission after Always, and then in the foreground is working. but when the app is killed not work.
thank you for replying and helping.
@vanlooverenkoen I tried real device (iphone 8 ios 15.5) and used your example project codes. unfortunately I don't have logs. but say me If you need something and how , I can provide you.
We created local notification to debug the background location tracking. That way you are 100% sure if it is working or not. Could you try that.
@Shahmirzali-Huseynov I have updated the example project in #40 . maybe you did not change the distance filter. (I forgot to change that as well, but after setting that to null I got updates every x seconds. while connected to my PC)
@vanlooverenkoen you mean If I define distanceFilterMeters to null it will work?
I am not sure how you are testing. But the distanceFilterMeters are set to 5. so If you don't move more than 5m you will not get any updates.
I tried your #40 example project. this function didn't affect. is it working for you?
final result = await Permission.locationAlways.request();
What do you mean by killed
? Completely removed from the resent apps? Or just send to the background. Because if you force quit the app from recents apple will kill all services and background services linked to your app
@vanlooverenkoen no generally, I run release #40 , on iPhone 8 real device, and just click the request location permission button, and nothing happens.
Let me double check that today.
I forgot to add:
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=1',
The pr is updated
@vanlooverenkoen Did you test example #40 in release run on real device IOS ? because when I run the app in debug mode location tracking is working (when the app is alive, not background or when is killed), but when I release run, location tracking not working even app isn't killed or on background/foreground. request permission working but tracking not working completely(run release).
Hmm you could also run on simulator and select bikeride for example. But in my case everything is working fine. Did you set your permissions to always allow
@vanlooverenkoen I mean in Release mode completely not working location tracking, even app is alive.
Can you test release mode on Real device IOS? when it's possible
@vanlooverenkoen I test also in the simulator. city run/biker too. but same when the app is killed it's not working
That is normal.
What do you mean by killed? Completely removed from the resent apps? Or just send to the background. Because if you force quit the app from recents apple will kill all services and background services linked to your app
Can you test by just closing the app but not killing the app. That should work normally.
I will also test on a real device. Thanks already for your feedback!! Much appreciated!
On the foreground/background, it's working. When the app is killed not work. but it's all in debug mode. In release mode completely nothing working unfortunately :/.
thank you for the package, your effort, and your support of the community.
Alright yes. killed state that is to be expected. That is an OS limitation.
I will check the release mode later today or tomorrow.
Indeed I am not receiving anything in release. That is strange. Let me investigate. Thing is we are using this (before #40) in production in 2 apps where it is work just fine. So that is strange.
When I go to the background I do see the blue pill in the status bar which indicates that the app is using location in the background. I saw the blue pill for a second right after you killed the app. And then it disappeared. (as expected)
Yes, location permission is working, but Tracking is not. I think Blue pill means the app has always location permission and be attention the app can track or track your location.
No blue pill actually means that is tracking in the background. Which it is doing. We are just doing something wrong when trying to contact the dart implementation
If you open your console. on mac you can see the extra logs to debug the native part.
You can see here what is happening. I will investigate this. And fix this major issue with #40 🙈
Okay, thank you for your effort. I will wait :)
Runner 14:46:07.056512+0200 [VERBOSE-2:dart_isolate.cc(668)] Could not resolve main entrypoint function.
Runner 14:46:07.056672+0200 [VERBOSE-2:dart_isolate.cc(167)] Could not run the run main Dart entrypoint.
Runner 14:46:07.057252+0200 [VERBOSE-2:runtime_controller.cc(385)] Could not create root isolate.
Runner 14:46:07.057945+0200 [VERBOSE-2:shell.cc(604)] Could not launch engine with configuration.
Maybe it is the same issue as we had on Android: long instead of int. but we are already using a Int64
in swift
Very weird that it does work ik debug on a real device. But not in release on a real device. 🤯
yes exactly, 🥲😔
I am getting the same error in release on Android. 🤯 It seems to be a flutter issue. because it is working perfectly in debug
I think I found it!! There was a bug related to this. (https://github.com/flutter/flutter/issues/91841#issuecomment-1006026551)
I found that I had to add the @pramga('vm:entry-point')
to make it work in release
@pragma('vm:entry-point')
void backgroundCallback() {
BackgroundLocationTrackerManager.handleBackgroundUpdated(
(data) async => Repo().update(data),
);
}
@Shahmirzali-Huseynov is it possible to test again?
Yeah, after adding @pragma('vm:entry-point')
it works. sorry for the delay. If you want, you can close the issue.
I will be fixing the comments on my pull request. and after that, I will close it.
It's working when the app is in the foreground, but when I close the app, not updating.
by the way, I got the always permission. there is no problem with permissions