Watch location updates from native app live in your browser. Locations are pushed to the browser via websocket and rendered on a google map.
Useful for debugging issues with cordova-plugin-mauron85-background-geolocation or react-native-mauron85-background-geolocation.
git clone https://github.com/mauron85/background-geolocation-server.git
cd background-geolocation-server
npm install
in index.html
replace {{{API KEY HERE}} with google api key
npm start
Configure plugin with options url
and syncUrl
:
var bgOptions = {
...
url: 'http://IP_ADDRESS_OF_SERVER:3000/locations',
syncUrl: 'http://IP_ADDRESS_OF_SERVER:3000/sync',
syncThreshold: 100,
httpHeaders: {
'X-FOO': 'bar'
},
...
};
// At some point call start() method of the plugin to start receiving location updates
http://localhost:3000
and watch for position updates as map markers
Following example apps can be used with this server:
There is Lockito app on play store to mock actual routes:
https://play.google.com/store/apps/details?id=fr.dvilleneuve.lockito
Follow project: https://github.com/lyft/set-simulator-location
It's possible to mock locations using Genymotion Shell. Read Genymotion blog post: Simulate GPS Movements Using GMTool & Genymotion Shell
If you prefer nodejs (over python), you can also use alternative genylocation.js
script. Follow blog post instructions how to prepare locations using google maps and gpsvisualizer. Instead of GPX format set gpsvisualizer:
- Output format to: Plain text
- Plain text delimiter: comma
Execute:
node genylocation.js your.csv
Or use repo sample:
node genylocation.js samples/sample_route.csv
NOTE: genyshell binary has to be accesible via shell $PATH property.