-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlocation.ts
More file actions
24 lines (20 loc) · 1.1 KB
/
location.ts
File metadata and controls
24 lines (20 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import * as Location from 'expo-location';
export const LOCATION_TASK_NAME = 'trainlcd-background-location-task';
export const LOCATION_ACCURACY = Location.Accuracy.Highest;
export const LOCATION_DISTANCE_INTERVAL = 5;
export const LOCATION_TIME_INTERVAL = 3000;
export const MAX_PERMIT_ACCURACY = 4000;
export const LOCATION_START_MAX_RETRIES = 3;
export const LOCATION_START_RETRY_BASE_DELAY_MS = 1000;
export const LOCATION_TASK_OPTIONS: Location.LocationTaskOptions = {
accuracy: LOCATION_ACCURACY,
distanceInterval: LOCATION_DISTANCE_INTERVAL,
timeInterval: LOCATION_TIME_INTERVAL,
// expo-task-managerはバックグラウンドでJobScheduler経由でJS側にデータを配信する。
// deferredUpdatesを両方0にするとFLPの更新ごとにジョブがスケジュールされ、
// Android 16でクォータ超過によりバックグラウンド更新が停止する。
// distanceは0にしないと停車中に更新が届かなくなる(AND条件のため)
deferredUpdatesInterval: LOCATION_TIME_INTERVAL,
deferredUpdatesDistance: 0,
pausesUpdatesAutomatically: false,
} as const;