react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

[Help Wanted]: Android terminated state

Open wmonecke-gen opened this issue 7 months ago β€’ 16 comments

Required Reading

  • [x] Confirmed

Plugin Version

^4.17.4

Mobile operating-system(s)

  • [ ] iOS
  • [x] Android

Device Manufacturer(s) and Model(s)

Poco F4

Device operating-systems(s)

Android 15

React Native / Expo version

0.74.2

What do you require assistance about?

Hey there!

The package works great in all states in iOS and in all but terminated state for Android. We bought a licence but haven't been able to get it to work in Android terminated mode.

The Logger logs dont show any specific errors or warnings.

Could you also point us to the TypeScript type of the android headless task Event? Looking through the code / docs / wiki, we dont see any way to properly type received by the .registerHeadlessTask.

[Optional] Plugin Code and/or Config

import { captureException } from '@sentry/react-native';
import BackgroundGeolocation, {
  Config,
} from 'react-native-background-geolocation';

import { NotificationChannelIds } from '~/constants/notification';
import i18n from '~/lib/i18n';
import { LocationErrorWithSetupError } from '~/types/locations/location-error';
import { errorLog, infoLog, successLog } from '~/utils/logging/logging-utils';

let setupState: 'idle' | 'ready' = 'idle';

type SuccessReturn = {
  success: true;
  message: string;
  error?: never;
};

type ErrorReturn = {
  success: false;
  error: LocationErrorWithSetupError;
  message: string;
};

export const setupBackgroundGeolocationConfig = async (): Promise<
  SuccessReturn | ErrorReturn
> => {
  try {
    if (setupState === 'ready') {
      infoLog('setupBackgroundGeolocationConfig:: Already ready');

      return {
        success: true,
        message: 'BackgroundGeolocation is ALREADY ready',
      };
    }

    infoLog(
      'setupBackgroundGeolocationConfig:: Setting up BackgroundGeolocation',
    );

    const config: Config = {
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
      distanceFilter: 100,

      // activity recognitison
      stopTimeout: 5,
      stopOnTerminate: false,
      startOnBoot: true,
      showsBackgroundLocationIndicator: false,
      enableHeadless: true,
      allowIdenticalLocations: false,
      disableElasticity: false,
      disableLocationAuthorizationAlert: true,
      disableMotionActivityUpdates: true,
      foregroundService: true,

      // android foreground notification
      notification: {
        title: 'Location Updates',
        text: 'Your location is being tracked for safety updates',
        channelName: 'Location Updates',
        smallIcon: 'mipmap/ic_notification',
        channelId: NotificationChannelIds.AndroidLocationForeground,
        priority: BackgroundGeolocation.NOTIFICATION_PRIORITY_MIN,
      },
      backgroundPermissionRationale: {
        title: i18n.t('Screens.Onboarding.BackgroundLocationDialogTitle'),
        message: i18n.t('Screens.Onboarding.BackgroundLocationDialogMessage'),
        positiveAction: i18n.t('Common.GoToSettings'),
        negativeAction: i18n.t('Common.Cancel'),
      },

      // debug
      debug: false,
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
      maxDaysToPersist: 1,
    };

    await BackgroundGeolocation.ready(config);

    successLog(
      'setupBackgroundGeolocationConfig:: BackgroundGeolocation is: ready',
    );

    setupState = 'ready';

    return { success: true, message: 'BackgroundGeolocation is NOW ready' };
  } catch (error) {
    errorLog('setupBackgroundGeolocationConfig:: error', error);

    captureException(error);

    setupState = 'idle';

    return {
      success: false,
      error: 4,
      message: `BackgroundGeolocation setup error: ${JSON.stringify(error)}`,
    };
  }
};

[Optional] Relevant log output


wmonecke-gen avatar May 08 '25 22:05 wmonecke-gen

Ill be adding logs in a few minutes after going outside and testing in terminated mode.

wmonecke-gen avatar May 08 '25 22:05 wmonecke-gen

See api docs .registerHeadlessTask.

To see your registered HeadlessTask fire, simply terminate your app while observing $ adb logcat logs and wait 10 seconds.

And enable debug: true so you can hear the debug soundFX.

christocracy avatar May 08 '25 22:05 christocracy

yup I do see the skull icon you mention in the wiki and see the terminate event. for whatever reason we are unable to do any work in the location event.

wmonecke-gen avatar May 08 '25 22:05 wmonecke-gen

btw is there a TS type for the event of registerHeadlessTask?

wmonecke-gen avatar May 08 '25 22:05 wmonecke-gen

btw is there a TS type for the event of registerHeadlessTask?

Like I said, see the api docs:

https://transistorsoft.github.io/react-native-background-geolocation/classes/backgroundgeolocation.html#registerheadlesstask

Image

christocracy avatar May 08 '25 22:05 christocracy

Yeah I saw that one a while ago, I guess I was expecting a discriminated union type. Ill do a round of testing and provide some logs. From current docs its hard to know what params looks like for each event.

wmonecke-gen avatar May 08 '25 22:05 wmonecke-gen

discriminated union type

I’m not a TS expert. I come from the old-school, of pure JavaScript of 20 years ago, a la Crockford.

christocracy avatar May 08 '25 23:05 christocracy

know what params looks like for each event.

The params object is generally the same as its corresponding onXxx event (eg .onLocation).

christocracy avatar May 08 '25 23:05 christocracy

Got it yeah, thanks! Just did another round of testing while driving.

this is my headlessTask, its very simple in that i just wanna process the position and if it matches a certain condition then in creates a notification. everything within processPositionNow is awaited as stated in the guide. the same logic is running on iOS in terminated and working as expected.

export const runBackgroundGeolocationHeadlessTask = async (
  event: BackgroundGeolocationEvent,
) => {
  try {
    if (event.name === 'location' && event.params) {
      const locationData = event.params as unknown as Location;

      const position: PositionUpdate = {
        accuracyInMeters: locationData.coords.accuracy,
        latitude: locationData.coords.latitude,
        longitude: locationData.coords.longitude,
        timestamp: new Date().getTime(),
        heading: locationData.coords.heading ?? null,
        altitudeInMeters: locationData.coords.altitude ?? null,
        speedInKmH: locationData.coords.speed ?? null,
        origin: 'location-tracking',
      };

      await processPositionNow(position);
    }
  } catch (error) {
    errorLog('runBackgroundGeolocationHeadlessTask:: error', error);
    captureException(error);
  }
};

I did manage to get the logs:

05-08 20:38:50.047 DEBUG [TSSQLiteAppender destroyLog] 
  πŸ”΅  Destroy log success
05-08 20:38:55.345 INFO [TSScheduleManager oneShot] 
  ⏰ Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
05-08 20:38:56.045 DEBUG [LifecycleManager onPause] ☯️  onPause
05-08 20:38:56.048 DEBUG [LifecycleManager onStop] ☯️  onStop
05-08 20:39:05.589 DEBUG [TSSQLiteAppender$c run] 
  ℹ️  Cleared logs older than 72 hours
05-08 20:39:05.589 INFO [LoggerFacade$a a] 
╔═════════════════════════════════════════════
β•‘ ⏰ OneShot event fired: TERMINATE_EVENT
╠═════════════════════════════════════════════

05-08 20:39:05.590 INFO [LoggerFacade$a a] 
  βœ…  Google Play Services: connected (version code:12451000)
05-08 20:39:05.590 DEBUG [HttpService startMonitoringConnectivityChanges] 
  🎾  Start monitoring connectivity changes
05-08 20:39:05.590 DEBUG [HeadlessTask onHeadlessEvent] πŸ’€  event: connectivitychange
05-08 20:39:05.591 DEBUG [LoggerFacade$a a] ☯️  onCreate
05-08 20:39:05.591 INFO [LoggerFacade$a a] 
╔═════════════════════════════════════════════
β•‘ TSLocationManager version: 3.6.3 (438)
╠═════════════════════════════════════════════
β•Ÿβ”€ Xiaomi 23113RKC6G @ 15 (react)
{
  "activityRecognitionInterval": 10000,
  "allowIdenticalLocations": false,
  "authorization": {},
  "autoSync": true,
  "autoSyncThreshold": 0,
  "backgroundPermissionRationale": {
    "title": "Allow to access to this device's location when closed or not in use?",
    "message": "In order for you to receive a notification when your location or a followed one are at an alerted status you'll need to enable {backgroundPermissionOptionLabel} location permission.",
    "positiveAction": "Open phone settings",
    "negativeAction": "Cancel"
  },
  "batchSync": false,
  "configUrl": "",
  "crashDetector": {
    "enabled": false,
    "accelerometerThresholdHigh": 20,
    "accelerometerThresholdLow": 4.5,
    "gyroscopeThresholdHigh": 20,
    "gyroscopeThresholdLow": 4.5
  },
  "debug": false,
  "deferTime": 0,
  "desiredAccuracy": -1,
  "desiredOdometerAccuracy": 100,
  "disableAutoSyncOnCellular": false,
  "disableElasticity": false,
  "disableLocationAuthorizationAlert": true,
  "disableMotionActivityUpdates": true,
  "disableProviderChangeRecord": false,
  "disableStopDetection": false,
  "distanceFilter": 100,
  "elasticityMultiplier": 1,
  "enableHeadless": true,
  "enableTimestampMeta": false,
  "extras": {},
  "fastestLocationUpdateInterval": -1,
  "foregroundService": true,
  "geofenceInitialTriggerEntry": true,
  "geofenceModeHighAccuracy": false,
  "geofenceProximityRadius": 1000,
  "geofenceTemplate": "",
  "headers": {},
  "headlessJobService": "com.transistorsoft.rnbackgroundgeolocation.HeadlessTask",
  "heartbeatInterval": -1,
  "httpRootProperty": "location",
  "httpTimeout": 60000,
  "isMoving": false,
  "locationAuthorizationRequest": "Always",
  "locationTemplate": "",
  "locationTimeout": 60,
  "locationUpdateInterval": 1000,
  "locationsOrderDirection": "ASC",
  "logLevel": 5,
  "logMaxDays": 3,
  "maxBatchSize": -1,
  "maxDaysToPersist": 1,
  "maxMonitoredGeofences": 97,
  "maxRecordsToPersist": -1,
  "method": "POST",
  "minimumActivityRecognitionConfidence": 75,
  "motionTriggerDelay": 0,
  "notification": {
    "layout": "",
    "title": "Location Updates",
    "text": "Your location is being tracked for safety updates",
    "color": "",
    "channelName": "Location Updates",
    "channelId": "android-location-foreground",
    "smallIcon": "mipmap\/ic_notification",
    "largeIcon": "",
    "priority": -2,
    "sticky": false,
    "strings": {},
    "actions": []
  },
  "params": {},
  "persist": true,
  "persistMode": 2,
  "schedule": [],
  "scheduleUseAlarmManager": false,
  "speedJumpFilter": 300,
  "startOnBoot": true,
  "stationaryRadius": 25,
  "stopAfterElapsedMinutes": 0,
  "stopOnStationary": false,
  "stopOnTerminate": false,
  "stopTimeout": 5,
  "triggerActivities": "in_vehicle, on_bicycle, on_foot, running, walking",
  "url": "",
  "useSignificantChangesOnly": false,
  "enabled": true,
  "schedulerEnabled": false,
  "trackingMode": 1,
  "odometer": 84.46748352050781,
  "isFirstBoot": false,
  "didLaunchInBackground": false,
  "didDeviceReboot": false
}
05-08 20:39:05.591 INFO [LoggerFacade$a a] 
╔═════════════════════════════════════════════
β•‘ DEVICE SENSORS
╠═════════════════════════════════════════════
β•Ÿβ”€ βœ…  ACCELEROMETER: {Sensor name="lsm6dsv Accelerometer Non-wakeup", vendor="STMicro", version=16384, type=1, maxRange=156.9064, resolution=0.0047856453, power=0.19, minDelay=5000}
β•Ÿβ”€ βœ…  GYROSCOPE: {Sensor name="lsm6dsv Gyroscope Non-wakeup", vendor="STMicro", version=16384, type=4, maxRange=34.906036, resolution=0.0012217296, power=0.53, minDelay=5000}
β•Ÿβ”€ βœ…  MAGNETOMETER: {Sensor name="qmc630x Magnetometer Non-wakeup", vendor="QST", version=131329, type=2, maxRange=3000.0, resolution=0.1, power=1.5, minDelay=10000}
β•Ÿβ”€ βœ…  SIGNIFICANT_MOTION: {Sensor name="sns_smd  Wakeup", vendor="QTI", version=1, type=17, maxRange=1.0, resolution=1.0, power=0.025, minDelay=-1}
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
05-08 20:39:05.592 DEBUG [LoggerFacade$a a] 
  ℹ️  Load last odometer location: Location[TSLocationManager 10.440285,-66.836183 hAcc=3.515 et=0 {Bundle[{odometer=84.46748}]}]
05-08 20:39:05.608 INFO [TSProviderManager startMonitoring] 
  🎾  Start monitoring location-provider changes
05-08 20:39:05.618 INFO [TSGeofenceManager start] 
  🎾  Start monitoring geofences
05-08 20:39:05.622 DEBUG [SQLiteLocationDAO prune] 
  ℹ️  PRUNE -1 days
05-08 20:39:05.647 DEBUG [LifecycleManager b] 
╔═════════════════════════════════════════════
β•‘ ☯️  HeadlessMode? true
╠═════════════════════════════════════════════

05-08 20:39:05.648 DEBUG [HeadlessTask onHeadlessEvent] πŸ’€  event: terminate
05-08 20:39:05.661 DEBUG [HeadlessTask onHeadlessEvent] πŸ’€  event: providerchange
05-08 20:39:09.139 DEBUG [TSGeofenceManager startMonitoringStationaryRegion] 
  🎾  Start monitoring stationary region (radius: 150.0m 10.4402853,-66.8361827 hAcc=3.515)
05-08 20:39:42.351 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 1
05-08 20:39:42.351 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 2
05-08 20:39:42.352 DEBUG [HeadlessTask$2 onHeadlessJsTaskStart] taskId: 3
05-08 20:39:42.435 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 1
05-08 20:39:42.436 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 3
05-08 20:39:42.436 DEBUG [HeadlessTask$2 onHeadlessJsTaskFinish] taskId: 2
05-08 23:26:44.192 DEBUG [LifecycleManager onStart] ☯️  onStart
05-08 23:26:44.196 DEBUG [LifecycleManager onResume] ☯️  onResume
05-08 23:26:44.433 DEBUG [ForegroundNotification createNotificationChannel] NotificationChannel{mId='android-location-foreground', mName=Location Updates, mDescription=, mImportance=1, mBypassDnd=false, mLockscreenVisibility=-1, mSound=null, mLights=false, mLightColor=0, mVibrationPattern=null, mVibrationEffect=null, mUserLockedFields=0, mUserVisibleTaskShown=false, mVibrationEnabled=false, mShowBadge=false, mDeleted=false, mDeletedTimeMs=-1, mGroup='null', mAudioAttributes=null, mBlockableSystem=false, mAllowBubbles=-1, mImportanceLockedDefaultApp=false, mOriginalImp=-1000, mParent=null, mConversationId=null, mDemoted=false, mImportantConvo=false, mLastNotificationUpdateTimeMs=0}
05-08 23:26:44.435 DEBUG [TSConfig e] ℹ️   Persist config, dirty: [backgroundPermissionRationale, backgroundPermissionRationale.title, backgroundPermissionRationale.message, backgroundPermissionRationale.positiveAction, backgroundPermissionRationale.negativeAction, desiredAccuracy, disableLocationAuthorizationAlert, disableMotionActivityUpdates, distanceFilter, enableHeadless, headlessJobService, logLevel, notification, notification.title, notification.text, notification.smallIcon, notification.priority, notification.channelName, notification.channelId, startOnBoot, stopOnTerminate]
05-08 23:26:44.437 DEBUG [LocationAuthorization withBackgroundPermission] 
  ℹ️  LocationAuthorization: Permission granted
05-08 23:26:44.437 DEBUG [HttpService startMonitoringConnectivityChanges] 
  🎾  Start monitoring connectivity changes
05-08 23:26:44.438 DEBUG [DeviceSettings startMonitoringPowerSaveChanges] 
  🎾  Start monitoring powersave changes
05-08 23:26:44.438 WARN [RNBackgroundGeolocationModule ready] 
  ⚠️  #ready already called.  Redirecting to #setConfig
05-08 23:26:44.440 INFO [HeartbeatService stop] 
  πŸ”΄  Stop heartbeat
05-08 23:26:44.447 INFO [TSLocationManager a] 
╔═════════════════════════════════════════════
β•‘ motionchange LocationResult: 1 (10180543ms old)
╠═════════════════════════════════════════════
β•Ÿβ”€ πŸ“  Location[fused 10.440285,-66.836183 hAcc=3.515 et=+8d17h36m1s714ms alt=1098.053466796875 vAcc=6.3371186 vel=0.31934595 sAcc=0.30241072 bear=130.75458 bAcc=10.191698], time: 1746751023903

05-08 23:26:44.447 DEBUG [TSLocationManager a] Median accuracy: 3.515
05-08 23:26:44.454 DEBUG [LocationAuthorization withPermission] 
  ℹ️  LocationAuthorization: Permission granted
05-08 23:26:44.454 INFO [TSLocationManager a] 
╔═════════════════════════════════════════════
β•‘ getCurrentPosition LocationResult: 2 (10180550ms old)
╠═════════════════════════════════════════════
β•Ÿβ”€ πŸ“  Location[fused 10.440285,-66.836183 hAcc=3.515 et=+8d17h36m1s714ms alt=1098.053466796875 vAcc=6.3371186 vel=0.31934595 sAcc=0.30241072 bear=130.75458 bAcc=10.191698], time: 1746751023903

05-08 23:26:44.454 DEBUG [TSLocationManager a] Median accuracy: 3.515
05-08 23:26:44.459 DEBUG [LocationAuthorization withPermission] 
  ℹ️  LocationAuthorization: Permission granted
05-08 23:26:44.467 DEBUG [AbstractService a] 
  🎾  start [LocationRequestService  startId: 1, eventCount: 1]
05-08 23:26:44.467 INFO [SingleLocationRequest startUpdatingLocation] 
  πŸ”΅  [SingleLocationRequest start, action: 1, requestId: 1]
05-08 23:26:44.468 DEBUG [AbstractService a] 
  βš™οΈοΈŽ   FINISH [LocationRequestService startId: 1, eventCount: 1, sticky: true]
05-08 23:26:44.469 DEBUG [AbstractService a] 
  🎾  start [LocationRequestService  startId: 2, eventCount: 1]
05-08 23:26:44.469 INFO [SingleLocationRequest startUpdatingLocation] 
  πŸ”΅  [SingleLocationRequest start, action: 2, requestId: 2]
05-08 23:26:44.473 DEBUG [AbstractService a] 
  βš™οΈοΈŽ   FINISH [LocationRequestService startId: 2, eventCount: 0, sticky: true]
05-08 23:26:44.678 DEBUG [TSGeofenceManager$d run] evaluation buffer timer elapsed
05-08 23:26:44.683 DEBUG [TSGeofenceManager$e run] 
╔═════════════════════════════════════════════
β•‘ TSGeofenceManager monitoring 0/0
╠═════════════════════════════════════════════
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
05-08 23:26:45.180 DEBUG [AbstractService a] 
  🎾  1:1 [LocationRequestService  startId: 3, eventCount: 1]
05-08 23:26:45.181 INFO [TSLocationManager a] 
╔═════════════════════════════════════════════
β•‘ motionchange LocationResult: 1 (545ms old)
╠═════════════════════════════════════════════
β•Ÿβ”€ πŸ“  Location[fused 10.435820,-66.856893 hAcc=15.092 et=+8d20h25m42s447ms alt=1004.7999877929688 vAcc=1.8325971], time: 1746761204636

05-08 23:26:45.182 INFO [TSLocationManager onSingleLocationResult] 
  πŸ”΅  Acquired motionchange position, isMoving: false
05-08 23:26:45.182 DEBUG [TSLocationManager a] Median accuracy: 3.515
05-08 23:26:45.185 DEBUG [AbstractService a] 
  🎾  2:2 [LocationRequestService  startId: 4, eventCount: 2]
05-08 23:26:45.190 DEBUG [AbstractService b] 
  🎾  STOP [LocationRequestService startId: 5, eventCount: 3]
05-08 23:26:45.190 DEBUG [AbstractService a] 
  βš™οΈοΈŽ   FINISH [LocationRequestService startId: 5, eventCount: 2, sticky: false]
05-08 23:26:45.192 DEBUG [TSGeofenceManager startMonitoringStationaryRegion] 
  🎾  Start monitoring stationary region (radius: 150.0m 10.4358202,-66.8568934 hAcc=15.092)
05-08 23:26:45.192 DEBUG [AbstractService a] 
  βš™οΈοΈŽ   FINISH [LocationRequestService startId: 3, eventCount: 1, sticky: false]
05-08 23:26:45.192 INFO [TSLocationManager a] 
╔═════════════════════════════════════════════
β•‘ getCurrentPosition LocationResult: 2 (556ms old)
╠═════════════════════════════════════════════
β•Ÿβ”€ πŸ“  Location[fused 10.435820,-66.856893 hAcc=15.092 et=+8d20h25m42s447ms alt=1004.7999877929688 vAcc=1.8325971], time: 1746761204636

05-08 23:26:45.193 INFO [TSLocationManager onSingleLocationResult] 
  πŸ”΅  Acquired current position
05-08 23:26:45.193 DEBUG [TSLocationManager a] Median accuracy: 9.3035
05-08 23:26:45.197 DEBUG [AbstractService a] 
  🎾  motionchange [TrackingService  startId: 1, eventCount: 1]
05-08 23:26:45.197 INFO [TrackingService k] 
╔═════════════════════════════════════════════
β•‘ TrackingService motionchange: false
╠═════════════════════════════════════════════

05-08 23:26:45.198 DEBUG [AbstractService a] 
  βš™οΈοΈŽ   FINISH [TrackingService startId: 1, eventCount: 0, sticky: false]
05-08 23:26:45.200 DEBUG [AbstractService a] 
  βš™οΈοΈŽ   FINISH [LocationRequestService startId: 4, eventCount: 1, sticky: false]
05-08 23:26:45.200 INFO [SQLiteLocationDAO persist] 
  βœ…  INSERT: aaf614ba-8f67-44e2-9805-8ffd78545046
05-08 23:26:45.201 DEBUG [AbstractService b] 
  🎾  STOP [LocationRequestService startId: 6, eventCount: 1]
05-08 23:26:45.201 DEBUG [AbstractService a] 
  βš™οΈοΈŽ   FINISH [LocationRequestService startId: 6, eventCount: 0, sticky: false]
05-08 23:26:45.399 DEBUG [AbstractService f] 
  βš™οΈοΈŽ  TrackingService.stopSelfResult(1): true
05-08 23:26:45.399 DEBUG [AbstractService onDestroy] 
  πŸ”΄  TrackingService stopped
05-08 23:26:45.402 DEBUG [AbstractService f] 
  βš™οΈοΈŽ  LocationRequestService.stopSelfResult(6): true
05-08 23:26:45.402 DEBUG [AbstractService onDestroy] 
  πŸ”΄  LocationRequestService stopped

I do see some headless events but for some reason it still is not doing the work its supposed to. I guess the next thing to do is to insert logs manually into the sdk and see if its failing silently? Any ideas on how to see why its not working?

wmonecke-gen avatar May 09 '25 03:05 wmonecke-gen

@christocracy what does disableMotionActivityUpdates actually do? we set this to false cuz the docs say that this prop is for

Disable the plugin requesting "Motion & Fitness" (ios) or "Physical Activity" (android >= 10) authorization from the User.

We are manually taking care of that in our app, we are seeing that putting this as false disables headless motion updates.

Can you confirm?

wmonecke-gen avatar May 12 '25 20:05 wmonecke-gen

Confirmed. The Motion api is an important part of this plug-in’s β€œPhilosophy of Operation” (see the wiki here of the same name).

christocracy avatar May 12 '25 20:05 christocracy

@christocracy What I am saying is that I think there is an error in the docs, please see what is written in JSDocs for disableMotionActivityUpdates. The docs mention requesting authorization but nothing related to the SDK not working if set to true.

wmonecke-gen avatar May 12 '25 21:05 wmonecke-gen

The plug-in won’t stop working if disabled. It’ll just take longer to detect when the device is moving and longer to detect the device has become stationary.

christocracy avatar May 12 '25 21:05 christocracy

Understood, thanks! From our testing we very very rarely got an update in terminated state with that boolean set to true.

wmonecke-gen avatar May 13 '25 13:05 wmonecke-gen

we very very rarely got an update in terminated state with that boolean set to true.

That would depend upon the device and the state of its Settings according to https://dontkillmyapp.com

When you disable the motion API, the plugin can only rely upon a 200 meter geofence around the last known position, the EXIT of which signals that the device is moving. Android geofences are not as reliable as iOS.

christocracy avatar May 13 '25 13:05 christocracy

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jun 13 '25 02:06 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 27 '25 02:06 github-actions[bot]