Comments (5)
In the API docs, of course
from cordova-background-geolocation-sampleapp.
Of course the API docs! Who would think to look there!
I do see the following in the Settings Controller:
$scope.centerOnMe = function () {
if (!$scope.map) {
return;
}
BackgroundGeolocationService.getCurrentPosition(function(location, taskId) {
$scope.map.setCenter(new google.maps.LatLng(location.coords.latitude, location.coords.longitude));
$scope.setCurrentLocationMarker(location);
BackgroundGeolocationService.finish(taskId);
}, function(error) {
console.error("- getCurrentPostion failed: ", error);
}, {
maximumAge: 0
});
};
When I modify the function like so:
$scope.centerOnMe = function () {
if (!$scope.map) {
return;
}
BackgroundGeolocationService.getCurrentPosition(function(location, taskId) {
$scope.map.setCenter(new google.maps.LatLng(location.coords.latitude, location.coords.longitude));
$scope.setCurrentLocationMarker(location);
var device = window.localStorage.getItem('device');
BackgroundGeolocationService.finish(taskId);
}, function(error) {
console.error("- getCurrentPostion failed: ", error);
}, {
maximumAge: 0,
extra: {
'device': device,
'foo': 'bar'
}
});
};
I see the following in my Console
[js] onMotionChange: false {"is_moving":false,"timestamp":"2015-11-17T20:02:22.043Z","uuid":"e9e4d0ef-469a-4bfb-b513-00e2c9759aec","coords":{"longitude":-90.3353283,"latitude":38.6489996,"accuracy":30,"speed":0,"heading":0,"altitude":0},"activity":{"type":"still","confidence":100},"battery":{"is_charging":true,"level":0.38999998569488525},"extras":{}}
As you can see extra is empty.
is there a way to test what exactly is being sent to the server?
from cordova-background-geolocation-sampleapp.
- You're looking for your
extras
in theonMotionChange
handler. They won't be there. Theextras
are only posted in the single location retrieved bygetCurrentPosition
. - The name is
extras
(plural) -- notextra
(singular). extras - However, I don't think the
extras
are echoed back to your Javascript callback. You can be sure that if you provideextras
togetCurrentPosition
, they are most certainly posted to your server.
from cordova-background-geolocation-sampleapp.
And btw, if you're looking to POST
Device info to your server, since this information is basically CONSTANT data, you'd be better off adding that to the plugin's #params config.
bgGeo.configure(success, fail, {
.
.
.
params: {
device: window.localStorage.getItem('device')
}
});
I do this in the SampleApp here
Anything added to #params
is appended to each HTTP request.
from cordova-background-geolocation-sampleapp.
Thanks for all the help!
from cordova-background-geolocation-sampleapp.
Related Issues (20)
- How can we post a mobile latitude and longitude to our server? HOT 1
- Locations are not captured at frequent intervals. HOT 1
- Location not being pushed to tracker.transistorsoft.com HOT 12
- Example doesn't work? HOT 19
- Hi I am using this plugin but custom locationTemplate is not working. HOT 1
- wrong distance is calculated HOT 1
- Javascript in sample app crashes HOT 4
- Usage HOT 3
- Android - using emulator with route HOT 3
- Sample app code doesn't work HOT 8
- Trouble with location on Android 10 when location is allowed only while using the app HOT 5
- Data is not reaching to server on App Terminate HOT 5
- background is stopped HOT 1
- framework not found TSLocationManager HOT 2
- Setting up clone of SampleApp for Android fails HOT 3
- failing to build sample app in Xcode HOT 5
- Plugin doesn’t sleep when user’s Location setting turned off
- Can the Bearer keyword in the authorization header be Excluded? HOT 1
- npm install error HOT 2
- npm install error on macOS Monterey HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-background-geolocation-sampleapp.