Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Swapniltdatalogy opened this issue Jul 18, 2017 · 32 comments
Closed

Comments

@Swapniltdatalogy
Copy link

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

  • Plugin version:
  • Platform: iOS or Android
  • OS version:
  • Device manufacturer / model:
  • Cordova version (cordova -v):
  • Cordova platform version (cordova platform ls):
  • Plugin config

Expected Behavior

Actual Behavior

Steps to Reproduce

Context

Debug logs

@christocracy
Copy link
Member

Logs please

@Swapniltdatalogy
Copy link
Author

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

@christocracy
Copy link
Member

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

@christocracy
Copy link
Member

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
Copy link
Author

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

@christocracy
Copy link
Member

So set up an email account.

@Swapniltdatalogy
Copy link
Author

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
Copy link
Member

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>
  1. Grant "Storage" permission Settings->Apps->[Your App]->Permissions: (o) Storage

@Swapniltdatalogy
Copy link
Author

Swapniltdatalogy commented Jul 18, 2017 via email

@christocracy
Copy link
Member

configure logLevel: 5 and try again.

@Swapniltdatalogy
Copy link
Author

@christocracy
Copy link
Member

There, that's better.

@christocracy
Copy link
Member

christocracy commented Jul 18, 2017

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
Copy link
Member

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
Copy link
Author

Please check this file for IOS
background-geolocation.zip

@christocracy
Copy link
Member

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

@Swapniltdatalogy
Copy link
Author

Yes

@christocracy
Copy link
Member

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

@Swapniltdatalogy
Copy link
Author

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

@christocracy
Copy link
Member

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

@Swapniltdatalogy
Copy link
Author

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

@christocracy
Copy link
Member

christocracy commented Jul 18, 2017

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

christocracy commented Jul 19, 2017 via email

@Swapniltdatalogy
Copy link
Author

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

@christocracy
Copy link
Member

What exactly are you expecting?

@christocracy
Copy link
Member

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

@Swapniltdatalogy
Copy link
Author

Okay

@Swapniltdatalogy
Copy link
Author

Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants