Skip to content

Commit

Permalink
- another fix to BG geolocation config.
Browse files Browse the repository at this point in the history
  • Loading branch information
YossiGreen committed Apr 13, 2020
1 parent d6294ad commit 8d76342
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/services/LocationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export const requestMotionPermissions = (updateService: boolean) => new Promise(
try {
const res = await request(motionPermission);

if (updateService && res === RESULTS.GRANTED) {
await BackgroundGeolocation.setConfig({ disableMotionActivityUpdates: true });
if (updateService && (res === RESULTS.GRANTED || res === RESULTS.UNAVAILABLE)) {
await BackgroundGeolocation.setConfig({ disableMotionActivityUpdates: false });
}

resolve(res === RESULTS.GRANTED);
Expand Down Expand Up @@ -114,7 +114,8 @@ export const startLocationTracking = async (locale: string, notificationData: No
}
}

const disableMotionActivityUpdates = await checkMotionPermissions() !== RESULTS.GRANTED;
const motionPermissions = await checkMotionPermissions();
const disableMotionActivityUpdates = (motionPermissions !== RESULTS.GRANTED && motionPermissions !== RESULTS.UNAVAILABLE);

await BackgroundGeolocation.ready({
// Geolocation Config
Expand Down

0 comments on commit 8d76342

Please sign in to comment.