transistorsoft / cordova-background-geolocation-lt

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
http://www.transistorsoft.com/shop/products/cordova-background-geolocation
Other
655 stars 277 forks source link

Not getting same latitude and longitude , when phone is statitionary #405

Closed Swapniltdatalogy closed 6 years ago

Swapniltdatalogy commented 6 years ago

Hello Chris, bgGeo.configure({ // Geolocation config desiredAccuracy: 0, distanceFilter: 5, stationaryRadius: 25, // Activity Recognition config activityRecognitionInterval: 10000, stopTimeout: 5, // Application config //debug: true, // <-- Debug sounds & notifications. stopOnTerminate: false, startOnBoot: true, preventSuspend: true, // HTTP / SQLite config url: "http://www.umbra.org/umbra-app/umbra-api/11umbra-testing-api.php?callback=JSON_CALLBACK&param=trackUserLocation&user_id=0&lat="+lat+"&longni="+lng, method: "POST", autoSync: true, maxDaysToPersist: 3, heartbeatInterval: 60, params: {
"auth_token": "maybe_your_server_authenticates_via_token_YES", "userid":window.localStorage.getItem('user_id'), "devicedate":window.localStorage.getItem('devicedate') }

}, function(state) {
   // alert('start one two three');
    if (!state.enabled) {
        bgGeo.start();
    }
});

This is my configuration . I implement heartbeat event after 1 min it work like charm .but im in my office with my ipad in stationary position .but every minute it takes different latitude and longitude . database schema for latitude and longitude . Please check screen shot -> https://www.screencast.com/t/lltCnL3W

Your Environment

Expected Behavior

Actual Behavior

Steps to Reproduce

1. 2. 3. 4.

Context

Debug logs

christocracy commented 6 years ago

Logs please

Swapniltdatalogy commented 6 years ago

Actually ,I build application with phone gap build , so can't able to give logs.

christocracy commented 6 years ago

Yes you can. The plugin records logs to its own database. See Logging Methods and #getLog

christocracy commented 6 years ago

don't send logs as an image. The logs can sometimes be > 1MB!

Just connect your app to Safari developer console and manually execute bg.getLog(callback). Copy / paste the output to a file and attach the file here to the issue.

Or use put a button on your UI to execute emailLog

Swapniltdatalogy commented 6 years ago

I'm trying to send mail but it throw error-> No mail Accounts.Please set up mail account in order to send mail

christocracy commented 6 years ago

So set up an email account.

Swapniltdatalogy commented 6 years ago

Email logs { "isMoving": false, "enabled": true, "odometer": 0, "schedulerEnabled": false, "trackingMode": "location", "distanceFilter": 5, "desiredAccuracy": 0, "desiredOdometerAccuracy": 100, "locationUpdateInterval": 1000, "fastestLocationUpdateInterval": 10000, "locationTimeout": 60, "deferTime": 0, "disableElasticity": false, "activityRecognitionInterval": 10000, "minimumActivityRecognitionConfidence": 75, "triggerActivities": "in_vehicle, on_bicycle, on_foot, running, walking", "disableStopDetection": false, "stationaryRadius": 25, "stopTimeout": 5, "stopOnStationary": false, "url": "http:\/\/www.umbra.org\/umbra-app\/umbra-api\/11umbra-testing-api.php?callback=JSON_CALLBACK&param=trackUserLocation&user_id=0&lat=0&longni=0", "method": "POST", "autoSync": true, "autoSyncThreshold": 0, "batchSync": false, "maxBatchSize": -1, "params": { "auth_token": "maybe_your_server_authenticates_via_token_YES", "userid": "235", "devicedate": null }, "headers": {}, "extras": {}, "httpRootProperty": "location", "locationTemplate": "", "geofenceTemplate": "", "persist": true, "maxDaysToPersist": 3, "maxRecordsToPersist": -1, "locationsOrderDirection": "ASC", "httpTimeout": 60000, "geofenceProximityRadius": 1000, "geofenceInitialTriggerEntry": true, "stopOnTerminate": false, "startOnBoot": true, "heartbeatInterval": 60, "foregroundService": false, "notificationTitle": "", "notificationText": "Location Service activated", "notificationColor": "", "notificationIcon": "", "notificationSmallIcon": "", "notificationLargeIcon": "", "forceReloadOnLocationChange": false, "forceReloadOnMotionChange": false, "forceReloadOnGeofence": false, "forceReloadOnBoot": false, "forceReloadOnHeartbeat": false, "forceReloadOnSchedule": false, "stopAfterElapsedMinutes": 0, "schedule": [], "configureUrl": "", "configureInterval": -1, "debug": true, "logLevel": 5, "logMaxDays": 3 }

christocracy commented 6 years ago

There are no logs attached. This is only the config.

Please carefully read the requirements for emailLog on Android:

  1. The following permissions are required in your AndroidManifest.xml in order to attach the .log file to the email:

    <manifest>
    <application>
    ...
    </application>
    
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    </manifest>
  2. Grant "Storage" permission Settings->Apps->[Your App]->Permissions: (o) Storage

Swapniltdatalogy commented 6 years ago

Please find attachment

christocracy commented 6 years ago

configure logLevel: 5 and try again.

Swapniltdatalogy commented 6 years ago

background-geolocation.log.gz

christocracy commented 6 years ago

There, that's better.

christocracy commented 6 years ago

I see no issue here. Of course locations will differ slightly every time you request a getCurrentPosition. You can see the reported accuracy of your locations 50, 30, 10, 10. Location recorded while indoors will naturally have poorer accuracy than those recorded outside, since GPS only works while outside. Indoor accuracy is typically 40-60 meters.

Unrelated, but your device is of poor quality for the type of tracking this plugin does, since it's has no gyroscope or magnetometer (compass). The plugin will have difficultly with motion-detection, which is a crucial for the plugin to detect when the device is moving / stationary. The activity-type reported by the plugin (ie: on_foot, in_vehicle, on_bicycle) will be highly inaccurate.

This has nothing to do with accuracy of locations, which are unaffected by motion-sensors.

╔═════════════════════════════════════════════
║ DEVICE SENSORS
╠═════════════════════════════════════════════
╟─ ✅  ACCELEROMETER: {Sensor name="K2HH Acceleration ", vendor="STM", version=1, type=1, maxRange=39.2266, resolution=0.0011971008, power=0.13, minDelay=10000}
╟─ ⚠️  GYROSCOPE:  none.  Motion-detection system performance will be degraded
╟─ ⚠️  MAGNETOMETER:  none.  Motion-detection system performance will be degraded
╟─ ⚠️  SIGNIFICANT_MOTION:  none.  Motion-detection system performance will be degraded
╚═════════════════════════════════════════════
christocracy commented 6 years ago

Please do not post long logs to the thread, forcing one to scroll 10 meters to get to bottom of page. attach them as files.

Swapniltdatalogy commented 6 years ago

Please check this file for IOS background-geolocation.zip

christocracy commented 6 years ago

What seems to be the problem in last logs? Is this a Wifi-only iPad?

Swapniltdatalogy commented 6 years ago

Yes

christocracy commented 6 years ago

Obviously performance on a Wifi-only device will be poor since there's no GPS on those devices.

Swapniltdatalogy commented 6 years ago

What seems to be the problem in last logs? Is this a Wifi-only iPad? NO there have. GPS .

christocracy commented 6 years ago

I don't see a problem in the logs. What are the symptoms?

Swapniltdatalogy commented 6 years ago

But difference of latitude and longitude is more than 100-200 meters. Still device in stationary?

christocracy commented 6 years ago

Yes, look at the location being recorded. It has an accuracy of 200 meters. This location is the best that device could provide at that particular location.

<+21.14949744,+79.11137715> +/- 200.00m (speed 0.00 mps / course -1.00) @ 7/18/17, 6:54:46 PM India Standard Time

There is no issue here.

christocracy commented 6 years ago

Correction. At 18:54:35, you did a getCurrentPosition

2017-07-18 18:54:35.300 - updateCurrentPosition: {
}

2017-07-18 18:54:35.301 🎾-[LocationManager startUpdatingLocation] ON

2017-07-18 18:54:35.323 ℹ️+[LocationAuthorization run:] status: 3

2017-07-18 18:54:35.331 
<+21.14944862,+79.11144117> +/- 65.00m (speed -1.00 mps / course -1.00) @ 7/18/17, 6:53:34 PM India Standard Time

2017-07-18 18:54:35.332 
╔═══════════════════════════════════════════════════════════
║ -[LocationManager locationManager:didUpdateLocations:] Sample 1 of 3
╚═══════════════════════════════════════════════════════════

2017-07-18 18:54:35.336 ✅ [BackgroundTaskManager createBackgroundTask]: 10

2017-07-18 18:54:35.783 
<+21.14950364,+79.11137709> +/- 65.00m (speed -1.00 mps / course -1.00) @ 7/18/17, 6:54:35 PM India Standard Time

2017-07-18 18:54:35.783 
╔═══════════════════════════════════════════════════════════
║ -[LocationManager locationManager:didUpdateLocations:] Sample 2 of 3
╚═══════════════════════════════════════════════════════════

2017-07-18 18:54:35.788 ✅ [BackgroundTaskManager createBackgroundTask]: 11

2017-07-18 18:54:41.311 
╔═══════════════════════════════════════════════════════════
║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/0 | isMoving: 0
╚═══════════════════════════════════════════════════════════

2017-07-18 18:54:41.311 - Shake count: 0

2017-07-18 18:54:41.312 🔴-[SOMotionDetector stopShakeDetection] OFF

2017-07-18 18:54:41.313 🎾-[SOMotionDetector startShakeDetection:] sample-rate: 1.0 | M7 DISABLED

2017-07-18 18:54:46.323 
<+21.14949744,+79.11137715> +/- 200.00m (speed 0.00 mps / course -1.00) @ 7/18/17, 6:54:46 PM India Standard Time

2017-07-18 18:54:46.323 🔴-[LocationManager stopUpdatingLocation] OFF

2017-07-18 18:54:46.326 
╔═══════════════════════════════════════════════════════════
║ -[LocationManager locationManager:didUpdateLocations:] Sample 3 of 3
╚═══════════════════════════════════════════════════════════

2017-07-18 18:54:46.327 - Median location accuracy: 65.0

3 samples were requested:

  1. <+21.14944862,+79.11144117> +/- 65.00m (speed -1.00 mps / course -1.00) @ 7/18/17, 6:53:34 PM India Standard Time
  2. <+21.14950364,+79.11137709> +/- 65.00m (speed -1.00 mps / course -1.00) @ 7/18/17, 6:54:35 PM India Standard Time
  3. <+21.14949744,+79.11137715> +/- 200.00m (speed 0.00 mps / course -1.00) @ 7/18/17, 6:54:46 PM India Standard Time

Only the best sample is returned to the getCurrentPosition callback. However, all samples are provided to the location event. These samples will have sample: true appended to the location data. These samples are not persisted to the database.

See the note about "samples" in the getCurrentPosition docs:

ℹ️ While the successFn will receive only one location, the plugin does request multiple location samples in order to record the most accurate location possible. These samples are not persisted to the database but they will be provided to your location event-listener, for your convenience, since it can take some seconds for the best possible location to arrive. For example, you might use these samples to progressively update the user's position on a map. You can detect these samples in your location callbackFn via location.sample === true. If you're manually POSTing location to your server, you should ignore these locations.

Swapniltdatalogy commented 6 years ago

Hello christocracy , Is there any option to detect location is off or on and suggest user to on location(GPS) .when our app is completely close.?

christocracy commented 6 years ago

The plugin automatically records and posts a location with event: "providerchange", appending the current provider data when user modifies location-services settings. See providerchange event.

Please stay on topic. Your issue is titled "Not getting same latitude and longitude , when phone is statitionary "

Swapniltdatalogy commented 6 years ago

Ok sorry for other topic "Not getting same latitude and longitude , when phone is stationary " . still not getting same latitude and longitude . is any option missing from below config. bgGeo.configure({ // Geolocation config desiredAccuracy: 100, distanceFilter: 10, stationaryRadius: 25, // Activity Recognition config activityRecognitionInterval: 10000, stopTimeout: 5, // Application config // debug: true, // <-- Debug sounds & notifications. stopOnTerminate: false, // logLevel :5, startOnBoot: true, preventSuspend: true, // HTTP / SQLite config url: "http://www.umbra.org/umbra-app/umbra-api/11umbra-testing-api.php?callback=JSON_CALLBACK&param=trackUserLocation&user_id=0&lat="+lat+"&longni="+lng, method: "POST", autoSync: true, desiredOdometerAccuracy: 10, maxDaysToPersist: 3, heartbeatInterval: 180, params: {
"auth_token": "maybe_your_server_authenticates_via_token_YES", "userid":window.localStorage.getItem('user_id'), "devicedate":window.localStorage.getItem('devicedate') }

}, function(state) {
   // alert('start one two three');
    if (!state.enabled) {
if(window.localStorage.getItem('user_id') == '' || window.localStorage.getItem('user_id') == null || window.localStorage.getItem('user_id') == undefined )
    {
    bgGeo.start();
        } 

    }
}); 
christocracy commented 6 years ago

You won't get the same lat/lng. It's to be expected that the location will change at any given moment, particularly while indoors, the location vary by tens-of-meters.

Also, what do you expect when you've configured desiredAccuracy: 100?

There is no issue here.

On Wed, Jul 19, 2017 at 6:45 AM Swapniltdatalogy notifications@github.com wrote:

Ok sorry for other topic "Not getting same latitude and longitude , when phone is stationary " . still not getting same latitude and longitude . is any option missing from below config. bgGeo.configure({ // Geolocation config desiredAccuracy: 100, distanceFilter: 10,

stationaryRadius: 25, // Activity Recognition config activityRecognitionInterval: 10000, stopTimeout: 5, // Application config

// debug: true, // <-- Debug sounds & notifications. stopOnTerminate: false, // logLevel :5,

startOnBoot: true, preventSuspend: true, // HTTP / SQLite config url: " http://www.umbra.org/umbra-app/umbra-api/11umbra-testing-api.php?callback=JSON_CALLBACK&param=trackUserLocation&user_id=0&lat="+lat+"&longni="+lng http://www.umbra.org/umbra-app/umbra-api/11umbra-testing-api.php?callback=JSON_CALLBACK&param=trackUserLocation&user_id=0&lat=%22+lat+%22&longni=%22+lng , method: "POST", autoSync: true,

desiredOdometerAccuracy: 10, maxDaysToPersist: 3, heartbeatInterval: 180,

params: { "auth_token": "maybe_your_server_authenticates_via_token_YES", "userid":window.localStorage.getItem('user_id'), "devicedate":window.localStorage.getItem('devicedate') }

}, function(state) { // alert('start one two three'); if (!state.enabled) { if(window.localStorage.getItem('user_id') == '' || window.localStorage.getItem('user_id') == null || window.localStorage.getItem('user_id') == undefined ) { bgGeo.start(); }

}

});

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/transistorsoft/cordova-background-geolocation-lt/issues/405#issuecomment-316346375, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA6l6ILKiNr_pqZplEgWu0D9A39KuXyks5sPd46gaJpZM4ObL2k .

-- Snet form Gmail Mobile

Swapniltdatalogy commented 6 years ago

I checked with desiredAccuracy : 0 also but not getting same result.

christocracy commented 6 years ago

What exactly are you expecting?

christocracy commented 6 years ago

I'm not at all surprised the location varies by 40-200 meters when you're sitting indoors.

Swapniltdatalogy commented 6 years ago

Okay

Swapniltdatalogy commented 6 years ago

Thanks for your help.