Closed ReemaBegum closed 6 years ago
I have no idea what this means. Show me what you mean with logs.
When I hit background geolocation plugin not getting response soon taking long time Here is my code var bgGeo = window.BackgroundGeolocation; // BackgroundGeolocation is highly configurable. See platform specific configuration options bgGeo.configure(callbackFn, failureFn, { desiredAccuracy: 0, stationaryRadius: 0, distanceFilter: 0, useSignificantChangesOnly: false, debug: false, stopOnTerminate: true, startOnBoot: false, stopTimeout: 1, stopDetectionDelay:0 }); // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app. bgGeo.start(); function callbackFn(location) { var coords = location.coords; var lat = coords.latitude; var lng = coords.longitude; } CallbackFn is not executing
Please use 3-backticks to format code.
And show me logs
Can you suggest me how to get log ?
See Wiki Debugging
This is my log 09-26 18:29:54.930 5293 5293 I TSLocationManager: [c.t.l.a.BackgroundGeolocation removeActivityUpdates] 09-26 18:29:54.930 5293 5293 I TSLocationManager: 🔴 Stop activity updates 09-26 18:29:54.931 5293 5853 I TSLocationManager: [c.t.l.l.TSLocationManager onSingleLocationResult] 09-26 18:29:54.931 5293 5853 I TSLocationManager: 🔵 Acquired motionchange position, isMoving: false 09-26 18:29:54.989 5293 5293 D TSLocationManager: [c.t.l.l.TSLocationManager stopSingleLocationRequests] 09-26 18:29:54.989 5293 5293 D TSLocationManager: 🔴 Stop LocationRequest: 1009 09-26 18:29:55.017 5293 5853 D TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] 24.18 09-26 18:29:55.039 5293 5293 D TSLocationManager: [c.t.l.a.BackgroundGeolocation isMainActivityActive] YES 09-26 18:29:55.052 5293 5293 I TSLocationManager: [c.t.l.BackgroundGeolocationService j] 09-26 18:29:55.052 5293 5293 I TSLocationManager: 🔴 Stop heartbeat
Below is my code bgGeo.configure(callbackFn, failureFn, { desiredAccuracy: 0, stationaryRadius: 0, distanceFilter: 0, useSignificantChangesOnly: false, debug: false, stopOnTerminate: true, startOnBoot: false, stopTimeout: 1, stopDetectionDelay:0 });
And what is your code doing when you "click on this button"?
debug: false
? Don't you think that might be important during development?logLevel
as well? Don't you want as much logging from the plugin as possible during development?I don't need to display any notification and sounds so set debug :false . Suggest me why it is taking time to get location when device is stationary state
On click of a button I need to get address by using latitude and longitude by making use of background geolocation am getting lat and long
Because the plugin samples multiple locations to find the most accurate possible. This can take some seconds. With debug: true
, you will hear these samples as the dial-tone sound.
Assuming you're using #getCurrentPosition
(I don't know, since you didn't show me your code), you might be interested in the samples
config option.
Here's the logs from executing #getCurrentPosition
: Multiple locations are fetched.
09-26 09:18:01.074 30141 30368 D TSLocationManager: $ getCurrentPosition()
09-26 09:18:01.172 30141 31578 I TSLocationManager: [c.t.l.LocationService onLocation]
09-26 09:18:01.172 30141 31578 I TSLocationManager: ℹ️ Location availability: true
09-26 09:18:03.513 30141 31579 D TSLocationManager: [c.t.l.LocationService onLocation]
09-26 09:18:03.513 30141 31579 D TSLocationManager: ╔═════════════════════════════════════════════
09-26 09:18:03.513 30141 31579 D TSLocationManager: ║ LocationService: location:1005
09-26 09:18:03.513 30141 31579 D TSLocationManager: ╠═════════════════════════════════════════════
09-26 09:18:03.513 30141 31579 D TSLocationManager: ╟─ 📍 Location[fused 45.519294,-73.616974 hAcc=19 et=+13d3h27m40s456ms vAcc=??? sAcc=??? bAcc=???], age: 257ms
09-26 09:18:03.538 30141 31579 D TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] 19.4305
09-26 09:18:03.569 14208 14208 D TSLocationManager: [c.t.l.a.BackgroundGeolocation isMainActivityActive] YES
09-26 09:18:05.335 14208 31581 D TSLocationManager: [c.t.l.LocationService onHeartbeat] ❤️
09-26 09:18:05.385 14208 14208 D TSLocationManager: [c.t.l.a.BackgroundGeolocation isMainActivityActive] YES
09-26 09:18:08.440 30141 31584 D TSLocationManager: [c.t.l.LocationService onLocation]
09-26 09:18:08.440 30141 31584 D TSLocationManager: ╔═════════════════════════════════════════════
09-26 09:18:08.440 30141 31584 D TSLocationManager: ║ LocationService: location:1005
09-26 09:18:08.440 30141 31584 D TSLocationManager: ╠═════════════════════════════════════════════
09-26 09:18:08.440 30141 31584 D TSLocationManager: ╟─ 📍 Location[fused 45.519304,-73.616981 hAcc=19 et=+13d3h27m45s469ms vAcc=??? sAcc=??? bAcc=???], age: 169ms
09-26 09:18:08.462 30141 31584 D TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] 19.429
09-26 09:18:08.504 14208 14208 D TSLocationManager: [c.t.l.a.BackgroundGeolocation isMainActivityActive] YES
09-26 09:18:13.451 30141 31587 D TSLocationManager: [c.t.l.LocationService onLocation]
09-26 09:18:13.451 30141 31587 D TSLocationManager: ╔═════════════════════════════════════════════
09-26 09:18:13.451 30141 31587 D TSLocationManager: ║ LocationService: location:1005
09-26 09:18:13.451 30141 31587 D TSLocationManager: ╠═════════════════════════════════════════════
09-26 09:18:13.451 30141 31587 D TSLocationManager: ╟─ 📍 Location[fused 45.519304,-73.616981 hAcc=19 et=+13d3h27m50s488ms vAcc=??? sAcc=??? bAcc=???], age: 158ms
09-26 09:18:13.476 30141 31587 D TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] 19.41
09-26 09:18:13.519 14208 14208 D TSLocationManager: [c.t.l.a.BackgroundGeolocation isMainActivityActive] YES
09-26 09:18:18.487 30141 31593 D TSLocationManager: [c.t.l.LocationService onLocation]
09-26 09:18:18.487 30141 31593 D TSLocationManager: ╔═════════════════════════════════════════════
09-26 09:18:18.487 30141 31593 D TSLocationManager: ║ LocationService: location:1005
09-26 09:18:18.487 30141 31593 D TSLocationManager: ╠═════════════════════════════════════════════
09-26 09:18:18.487 30141 31593 D TSLocationManager: ╟─ 📍 Location[fused 45.519294,-73.616974 hAcc=19 et=+13d3h27m55s508ms vAcc=??? sAcc=??? bAcc=???], age: 177ms
09-26 09:18:18.531 30141 31593 D TSLocationManager: [c.t.l.l.TSLocationManager calculateMedianAccuracy] 19.391
09-26 09:18:18.586 14208 14208 D TSLocationManager: [c.t.l.a.BackgroundGeolocation isMainActivityActive] YES
09-26 09:18:25.812 30141 31597 D TSLocationManager: [c.t.l.LocationService onLocation]
09-26 09:18:25.812 30141 31597 D TSLocationManager: ╔═════════════════════════════════════════════
09-26 09:18:25.812 30141 31597 D TSLocationManager: ║ LocationService: location:1005
09-26 09:18:25.812 30141 31597 D TSLocationManager: ╠═════════════════════════════════════════════
09-26 09:18:25.812 30141 31597 D TSLocationManager: ╟─ 📍 Location[fused 45.519294,-73.616974 hAcc=19 et=+13d3h28m2s879ms vAcc=??? sAcc=??? bAcc=???], age: 133ms
09-26 09:18:25.832 30141 31597 I TSLocationManager: [c.t.l.l.TSLocationManager onSingleLocationResult]
09-26 09:18:25.832 30141 31597 I TSLocationManager: 🔵 Acquired current position
On click of a button I need to get address by using latitude and longitude by making use of background geolocation am getting lat and long
I'm not concerned with what you need to do with the location. I want to see your code.
And yes, if you execute #getCurrentPosition
while indoors, it will take longer to fetch the location since GPS isn't available indoors. If the plugin fetches a high accuracy location (eg: <= 10 meters
), it will immediately stop sampling and return that location immediately.
Right now am using this here is my code . Do I need to do any changes in configure options ? bgGeo.configure(callbackFn, failureFn, { desiredAccuracy: 0, stationaryRadius: 0, distanceFilter: 0, useSignificantChangesOnly: true, debug: false, stopOnTerminate: true, startOnBoot: false, stopTimeout: 1, stopDetectionDelay:0 } ) function callbackFn(location) { var coords = location.coords; var lat = coords.latitude; var lng = coords.longitude; }
Please learn to format code. Right below the textarea i'm writing in is a link Styling with Markdown is supported.
Wrap code with 3-backticks
Just edit your previous post.
When I open application in android it showing "License validation failure background geolocation running in evaluation mode " . We have purchased the license for this do I need to do any changes in config file ?
As you suggested to use #getCurrentPosition is there any parameter to specify time limit ?
This issue is related to "Delay in getting Location".
Customers shouldn't use this public repo (it contains only latest stable release. Customers are granted access to a private repo for latest updates.
Are you reading the docs for #getCurrentPosition?
Yes, we are using private repo
Then why are you posting issues to the public repo?
When background geolocation is called taking more time to fetch location service . Any suggesstion on this will help me lot ?
Your Environment
cordova platform ls
):6.1.1