Closed arslancs closed 3 weeks ago
its give one time location after that its not work
Thatβs exactly what this plug-in is designed to do. Read the wiki βPhilosophy of Operationβ.
then go outside and move at least 1000 meters.
So there is no method or function that returns the location after some interval whether the user changes his location or not? @christocracy
No. Thatβs what background-fetch is for (already included as a dependency and also created by Transistor Software):
https://github.com/transistorsoft/react-native-background-fetch
This plugin is fully function in DEBUG builds so you can try before you buy, as noted at the top of the README
@christocracy in debug why its showing license validation failed ?
It's normal. Ignore it. As long as it's a DEBUG build, it's fully functional.
this is my code , im getting location when close the app and open it , but in background im not getting location , but app showing getting location sign in background too! void _startBackgroundGeolocation() { bg.BackgroundGeolocation.onLocation((bg.Location location) { _connectSocketAndEmit(location.coords.latitude.toString(), location.coords.longitude.toString()); });
bg.BackgroundGeolocation.ready(bg.Config(
desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
distanceFilter: 0,
disableElasticity: true,
stopOnTerminate: false,
enableHeadless: true,
startOnBoot: true,
debug: true,
logLevel: bg.Config.LOG_LEVEL_VERBOSE))
.then((bg.State state) {
if (!state.enabled) {
bg.BackgroundGeolocation.start();
}
});
}
i need to test before buying it ! @christocracy
but in background im not getting location
What makes you think that? Are you observing the plugin logs? See Wiki "Debugging". You should be observing the log stream:
$ adb logcat *:S TSLocationManager:V
The plugin is telling you everything it's doing in the logs.
You should be hearing debug Sound FX. If you hear the soundFX, it's working.
what do mean by plugin logs ? im hitting socket on location change method to get bg location updates , bg.BackgroundGeolocation.onLocation((bg.Location location) { _connectSocketAndEmit(location.coords.latitude.toString(), location.coords.longitude.toString()); }); so bg.BackgroundGeolocation.onLocation method will not perform callback in bg ? @christocracy
what do mean by plugin logs ?
Ready the Wiki "Debugging". Learn to observe the plugin logs. This plugin has an incredibly verbose logging system that logs absolutely everything it's doing.
so bg.BackgroundGeolocation.onLocation method will not perform callback in bg
No, that's NOT true.
Are you confused about background vs terminated? They are two completely different states.
@christocracy thanks got it , u mean it ll not work when app is terminated , if not then u must need to work on it to run when this when app is killed!
u mean it ll not work when app is terminated
No, that's NOT what I mean. Why do you think the plugin contains the option stopOnTerminate: false
?
Are you confused about background vs terminated?
Are you talking about the terminated OR background state?
when app is terminated , its bg.BackgroundGeolocation.onLocation callback is not working, then how can i get logs of location when app is terminated ? what ll b use of stopOnTerminate: false etc!
when app is terminated , its bg.BackgroundGeolocation.onLocation
For the Android terminated state, see API docs Config.enableHeadless
Your Flutter App
instance (where your UI lives) no longer exists when an Android app is terminated.
So, no: .onLocation
does NOT fire when the Android app is terminated. You need to register a "headless task", as described in the API docs linked above.
background and terminated are two completely different Android App states.
exactly what im saying! bg.BackgroundGeolocation.onLocation will not work when app is terminated! yes i know ,background and terminated state, thanks for clearing it!
exactly what im saying!
No, that's not exactly what you've been saying. What you said is "but in background im not getting location".
background != terminated
.
thank you!
Your Environment
flutter doctor
): not issue foundPlugin config:
Expected Behavior
i need to location on after every specific time or interval ,
Actual Behavior
when i call onLocation method first time on installing the apk it give me location perfectly but after that it failed to give me update
Steps to Reproduce
1. 2. 3. 4.
Context
Debug logs
I/TSLocationManager(28697): ββ π Location[fused 31.493771,74.417442 hAcc=15.043 et=+13d16h29m18s197ms alt=195.10000610351562 vAcc=1.0], time: 1730113515566 I/TSLocationManager(28697): [c.t.l.d.s.SQLiteLocationDAO persist] I/TSLocationManager(28697): β INSERT: d29176f3-7791-4774-baa2-574268285676 D/TSLocationManager(28697): [c.t.l.g.TSGeofenceManager startMonitoringStationaryRegion] D/TSLocationManager(28697): πΎ Start monitoring stationary region (radius: 150.0m 31.4937708,74.4174417 hAcc=15.043) I/TSLocationManager(28697): [c.t.l.l.TSLocationManager onSingleLocationResult] I/TSLocationManager(28697): π΅ Acquired motionchange position, isMoving: false D/TSLocationManager(28697): [c.t.l.l.TSLocationManager a] Median accuracy: 14.037001 D/TSLocationManager(28697): [c.t.l.service.AbstractService a] D/TSLocationManager(28697): βοΈοΈ FINISH [LocationRequestService startId: 4, eventCount: 0, sticky: false] I/flutter (28697): Location emitted: Latitude: 31.4937708, Longitude: 74.4174417 I/TSLocationManager(28697): [c.t.l.d.s.SQLiteLocationDAO persist] I/TSLocationManager(28697): β INSERT: f2b0f873-ef90-4a17-b872-d574f1924d82 D/TSLocationManager(28697): [c.t.l.g.TSGeofenceManager startMonitoringStationaryRegion] D/TSLocationManager(28697): πΎ Start monitoring stationary region (radius: 150.0m 31.4937708,74.4174417 hAcc=15.043) D/TSLocationManager(28697): [c.t.l.service.AbstractService b] D/TSLocationManager(28697): πΎ STOP [LocationRequestService startId: 6, eventCount: 1] D/TSLocationManager(28697): [c.t.l.service.AbstractService a] D/TSLocationManager(28697): βοΈοΈ FINISH [LocationRequestService startId: 6, eventCount: 0, sticky: false] I/flutter (28697): Location emitted: Latitude: 31.4937708, Longitude: 74.4174417 D/TSLocationManager(28697): [c.t.l.service.AbstractService a] D/TSLocationManager(28697): πΎ motionchange [TrackingService startId: 1, eventCount: 1] I/TSLocationManager(28697): [c.t.l.service.TrackingService k] I/TSLocationManager(28697): ββββββββββββββββββββββββββββββββββββββββββββββ I/TSLocationManager(28697): β TrackingService motionchange: false I/TSLocationManager(28697): β βββββββββββββββββββββββββββββββββββββββββββββ D/TSLocationManager(28697): [c.t.l.service.AbstractService a] D/TSLocationManager(28697): βοΈοΈ FINISH [TrackingService startId: 1, eventCount: 0, sticky: false] D/TSLocationManager(28697): [c.t.l.service.AbstractService f] D/TSLocationManager(28697): βοΈοΈ LocationRequestService.stopSelfResult(6): true D/TSLocationManager(28697): [c.t.l.service.AbstractService onDestroy] D/TSLocationManager(28697): π΄ LocationRequestService stopped D/TSLocationManager(28697): [c.t.l.service.AbstractService f] D/TSLocationManager(28697): βοΈοΈ TrackingService.stopSelfResult(1): true D/TSLocationManager(28697): [c.t.l.service.AbstractService onDestroy] D/TSLocationManager(28697): π΄ TrackingService stopped
``` PASTE_YOUR_LOGS_HERE ```