You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BackgroundGeolocation.configure({
desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
stationaryRadius: 50,
distanceFilter: 500,
notificationsEnabled: false,
debug: false,
startOnBoot: true,
stopOnTerminate: false,
locationProvider: BackgroundGeolocation.DISTANCE_FILTER_PROVIDER,
interval: 10000,
fastestInterval: 5000,
activitiesInterval: 10000,
stopOnStillActivity: false,
maxLocations: 10,
syncThreshold: 5,
url: 'https://example.com', // Actual website here in full project
httpHeaders: {
'Accept': 'application/json',
'Content-Type': 'multipart/form-data'
},
// customize post properties
postTemplate: {
Email: '[email protected]',
UserID: 'fakeID',
PushKey: 'fakePushKey',
latitude: '@latitude',
longitude: '@longitude',
i_Meta_Data: 1
}
});
BackgroundGeolocation.on('location', (location) => {
BackgroundGeolocation.startTask(taskKey => {
console.log('ON location: ', location);
BackgroundGeolocation.endTask(taskKey);
});
});
BackgroundGeolocation.on('stationary', (stationaryLocation) => {
// handle stationary locations here
console.log('[INFO] BackgroundGeolocation service is stationary');
});
BackgroundGeolocation.on('error', (error) => {
console.log('[ERROR] BackgroundGeolocation error:', error);
});
BackgroundGeolocation.on('start', () => {
console.log('[INFO] BackgroundGeolocation service has been started');
BackgroundGeolocation.startTask(taskKey => {
console.log('ON location: ', location);
BackgroundGeolocation.endTask(taskKey);
});
});
BackgroundGeolocation.on('stop', () => {
console.log('[INFO] BackgroundGeolocation service has been stopped');
// BackgroundGeolocation.start();
});
BackgroundGeolocation.on('authorization', (status) => {
console.log('[INFO] BackgroundGeolocation authorization status: ' + status);
if (status !== BackgroundGeolocation.AUTHORIZED) {
// we need to set delay or otherwise alert may not be shown
setTimeout(() =>
Alert.alert('App requires location tracking permission', 'Would you like to open app settings?', [
{ text: 'Yes', onPress: () => BackgroundGeolocation.showAppSettings() },
{ text: 'No', onPress: () => console.log('No Pressed'), style: 'cancel' }
]), 1000);
}
});
BackgroundGeolocation.on('background', () => {
console.log('[INFO] App is in background');
this.setState({
isBackground: true,
});
});
BackgroundGeolocation.on('foreground', () => {
console.log('[INFO] App is in foreground');
this.setState({
isBackground: false,
});
});
BackgroundGeolocation.on('abort_requested', () => {
console.log('[INFO] Server responded with 285 Updates Not Required');
});
BackgroundGeolocation.on('http_authorization', () => {
console.log('[INFO] App needs to authorize the http requests');
});
BackgroundGeolocation.checkStatus(status => {
console.log('[INFO] BackgroundGeolocation service is running', status.isRunning);
console.log('[INFO] BackgroundGeolocation services enabled', status.locationServicesEnabled);
console.log('[INFO] BackgroundGeolocation auth status: ' + status.authorization);
});
Link to your project: N/A
Context
The postTemplate information is never sent to the url provided in the configuration of BackgroundGeolocation. Additionally, tasks are never ran when the app is terminated even though stopOnTerminate is set to false.
Expected Behavior
The postTemplate should be sent to the url provided in the configuration of BackgroundGeolocation.
Actual Behavior
There is no indication that the postTemplate information is being sent to the provided url on the app's side. The back end does not claim to have received any information from the app.
Possible Fix
Steps to Reproduce
Define a BackgroundGeolocation configuration as shown above.
Run the task based on location updates using BackgroundGeolocation.on('location')
Check for an indication that information was sent on both the front end and the back end.
Context
Trying to send location information to a back-end, where it is then sent into a database. While it is possible to send information through BackgroundGeolocation.on('location'), this does not allow for the sending of location information when the app is terminated.
Debug logs
The text was updated successfully, but these errors were encountered:
Your Environment
Context
The
postTemplate
information is never sent to theurl
provided in the configuration of BackgroundGeolocation. Additionally, tasks are never ran when the app is terminated even thoughstopOnTerminate
is set to false.Expected Behavior
The
postTemplate
should be sent to theurl
provided in the configuration of BackgroundGeolocation.Actual Behavior
There is no indication that the
postTemplate
information is being sent to the providedurl
on the app's side. The back end does not claim to have received any information from the app.Possible Fix
Steps to Reproduce
BackgroundGeolocation.on('location')
Context
Trying to send location information to a back-end, where it is then sent into a database. While it is possible to send information through
BackgroundGeolocation.on('location')
, this does not allow for the sending of location information when the app is terminated.Debug logs
The text was updated successfully, but these errors were encountered: