@@ -130,19 +130,27 @@ export class OBackgroundLocationService {
130130 ) ;
131131
132132 this . heartbeatSubscription = BackgroundGeolocation . onHeartbeat (
133- async ( event ) => {
133+ ( event ) => {
134134 Sentry . captureMessage (
135135 `Captured heartbeat in location service` ,
136136 ) ;
137- const loc = await BackgroundGeolocation . getCurrentPosition ( {
137+ BackgroundGeolocation . getCurrentPosition ( {
138138 samples : 1 ,
139139 desiredAccuracy :
140140 BackgroundGeolocation . DESIRED_ACCURACY_NAVIGATION ,
141+ } ) ?. then ( ( loc ) => {
142+ this . saveLocation (
143+ loc ?. coords ?. latitude ,
144+ loc ?. coords ?. longitude ,
145+ ) . catch ( ( error ) => {
146+ Sentry . captureException ( error , {
147+ tags : {
148+ location_service :
149+ "heartBeatSaveLocation:fail" ,
150+ } ,
151+ } ) ;
152+ } ) ;
141153 } ) ;
142- await this . saveLocation (
143- loc ?. coords ?. latitude ,
144- loc ?. coords ?. longitude ,
145- ) ;
146154 } ,
147155 ) ;
148156
@@ -172,6 +180,7 @@ export class OBackgroundLocationService {
172180 autoSync : false , // TODO: makes sense in future? sync each location to server as it arrives
173181 locationUpdateInterval : 5 * 60 * 1000 , // 5 minutes
174182 fastestLocationUpdateInterval : 3 * 60 * 1000 , // 3 minutes
183+ locationTimeout : 180 , // @dev extend timeout due to errors within 60s default range
175184 activityType :
176185 BackgroundGeolocation . ACTIVITY_TYPE_OTHER_NAVIGATION ,
177186 preventSuspend : true , // @dev https://transistorsoft.github.io/react-native-background-geolocation/interfaces/config.html#preventsuspend
@@ -180,7 +189,7 @@ export class OBackgroundLocationService {
180189 title : i18n . t ( TR . bgLocationServiceTitle ) ,
181190 text : i18n . t ( TR . bgLocationServiceBody ) ,
182191 color : Color . primary ,
183- smallIcon : "location_icon" , // TODO: working?
192+ smallIcon : "location_icon" ,
184193 } ,
185194 } ) ;
186195 } catch ( error ) {
0 commit comments