Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android app crashes when using backgroundgeolocation.start() #1732

Closed
Shahaab-1 opened this issue Jun 30, 2023 · 4 comments
Closed

Android app crashes when using backgroundgeolocation.start() #1732

Shahaab-1 opened this issue Jun 30, 2023 · 4 comments

Comments

@Shahaab-1
Copy link

Shahaab-1 commented Jun 30, 2023

Your Environment

  • Plugin version:4.12.1
  • Platform: iOS or Android Android
  • OS version:13
  • Device manufacturer / model:Samsung galaxy A13
  • React Native version (react-native -v):0.70.4
  • Plugin config
const [loading, setLoading] = useState(false);
  const [isPaused, setPaused] = useState(false);
  const [location, setLocation] = React.useState('');
  const applicationName = 'Teb cloud sales';
  const backgroundPermissionOptionLabel = 'Allow all the time';
  React.useEffect(() => {
    /// 1.  Subscribe to events.
    const onLocation = BackgroundGeolocation.onLocation(location => {
      console.log('[onLocation]', location);
      setLocation(JSON.stringify(location, null, 2));
    });

    const onMotionChange = BackgroundGeolocation.onMotionChange(event => {
      console.log('[onMotionChange]', event);
    });

    const onActivityChange = BackgroundGeolocation.onActivityChange(event => {
      console.log('[onMotionChange]', event);
    });

    const onProviderChange = BackgroundGeolocation.onProviderChange(event => {
      console.log('[onProviderChange]', event);
    });

    /// 2. ready the plugin.
    BackgroundGeolocation.ready({
      // Geolocation Config
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
      distanceFilter: 10,
      // Activity Recognition
      stopTimeout: 5,
      motionTriggerDelay: 1000,
      // Application config
      debug: true, // <-- enable this hear sounds for background-geolocation life-cycle.
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
      backgroundPermissionRationale: {
        title: `Allow ${applicationName} to access to this device's location in the background?`,
        message: `In order to track your activity in the background, please enable ${backgroundPermissionOptionLabel} location permission`,
        positiveAction: `Change to ${backgroundPermissionOptionLabel}`,
        negativeAction: 'Cancel',
      },
      stopOnTerminate: false, // <-- Allow the background-service to continue tracking when user closes the app.
      startOnBoot: true, // <-- Auto start tracking when device is powered-up.
      // HTTP / SQLite config
      url: 'http://yourserver.com/locations',
      batchSync: false, // <-- [Default: false] Set true to sync locations to server in a single HTTP request.
      autoSync: false, // <-- [Default: true] Set true to sync each location to server as it arrives.
    }).then(state => {
      console.log(
        '[BackgroundGeolocation config] state: ',
        JSON.stringify(state, null, 2),
      );
 BackgroundGeolocation.start();
      console.log(
        '- BackgroundGeolocation is configured and ready: ',
        state.enabled,
      );
    });

    return () => {
      // Remove BackgroundGeolocation event-subscribers when the View is removed or refreshed
      // during development live-reload.  Without this, event-listeners will accumulate with
      // each refresh during live-reload.
      onLocation.remove();
      onMotionChange.remove();
      onActivityChange.remove();
      onProviderChange.remove();
    };
  }, []);

Expected Behavior

state.enabled should be true to perform further tasks.

Actual Behavior

state.enabled is false and the app crashes when I use BackgroundGeolocation.getCurrentPosition or any other task

Steps to Reproduce

1.Did the setup as instructed and added the key in manifest file
2.configured the background geolocation in usestate function
3.getting state.enabled as false
4.the app crashes whenever I try to use backgroundgeolocation.start() or backgroundgeolocation.getcurrentposition

Context

Not much context, just trying to configure the background geolocation

Debug logs

06-30 18:04:44.813 24323 24415 D TSLocationManager: [c.t.l.logger.LoggerFacade$a a] PID: 2
06-30 18:04:44.813 24323 24424 D TSLocationManager: [c.t.l.l.TSSQLiteAppender$c run] 
06-30 18:04:44.813 24323 24424 D TSLocationManager:   ℹ️  Cleared logs older than 72 hours
06-30 18:04:44.815 24323 24415 I TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 
06-30 18:04:44.815 24323 24415 I TSLocationManager: ╔═════════════════════════════════════════════
06-30 18:04:44.815 24323 24415 I TSLocationManager: ║ TSLocationManager version: 3.4.0 (420)
06-30 18:04:44.815 24323 24415 I TSLocationManager: ╠═════════════════════════════════════════════
06-30 18:04:44.815 24323 24415 I TSLocationManager: ╟─ samsung SM-A135F @ 13 (react-native)
06-30 18:04:44.815 24323 24415 I TSLocationManager: {
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "activityRecognitionInterval": 10000,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "allowIdenticalLocations": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "authorization": {},
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "autoSync": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "autoSyncThreshold": 0,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "backgroundPermissionRationale": {
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "title": "Allow Teb cloud sales to access to this device's location in the background?",
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "message": "In order to track your activity in the background, please enable Allow all the time location permission",
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "positiveAction": "Change to Allow all the time",
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "negativeAction": "Cancel"
06-30 18:04:44.815 24323 24415 I TSLocationManager:   },
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "batchSync": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "configUrl": "",
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "debug": true,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "deferTime": 0,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "desiredAccuracy": -1,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "desiredOdometerAccuracy": 100,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "disableAutoSyncOnCellular": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "disableElasticity": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "disableLocationAuthorizationAlert": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "disableMotionActivityUpdates": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "disableProviderChangeRecord": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "disableStopDetection": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "distanceFilter": 10,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "elasticityMultiplier": 1,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "enableHeadless": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "enableTimestampMeta": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "extras": {},
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "fastestLocationUpdateInterval": -1,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "foregroundService": true,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "geofenceInitialTriggerEntry": true,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "geofenceModeHighAccuracy": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "geofenceProximityRadius": 1000,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "geofenceTemplate": "",
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "headers": {},
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "headlessJobService": "com.transistorsoft.rnbackgroundgeolocation.HeadlessTask",
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "heartbeatInterval": -1,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "httpRootProperty": "location",
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "httpTimeout": 60000,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "isMoving": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "locationAuthorizationRequest": "Always",
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "locationTemplate": "",
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "locationTimeout": 60,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "locationUpdateInterval": 1000,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "locationsOrderDirection": "ASC",
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "logLevel": 5,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "logMaxDays": 3,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "maxBatchSize": -1,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "maxDaysToPersist": 1,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "maxRecordsToPersist": -1,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "method": "POST",
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "minimumActivityRecognitionConfidence": 75,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "motionTriggerDelay": 1000,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "notification": {
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "layout": "",
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "title": "",
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "text": "Location Service activated",
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "color": "",
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "channelName": "TSLocationManager",
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "channelId": "",
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "smallIcon": "",
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "largeIcon": "",
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "priority": 0,
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "sticky": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "strings": {},
06-30 18:04:44.815 24323 24415 I TSLocationManager:     "actions": []
06-30 18:04:44.815 24323 24415 I TSLocationManager:   },
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "params": {},
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "persist": true,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "persistMode": 2,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "schedule": [],
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "scheduleUseAlarmManager": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "speedJumpFilter": 300,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "startOnBoot": true,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "stationaryRadius": 25,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "stopAfterElapsedMinutes": 0,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "stopOnStationary": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "stopOnTerminate": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "stopTimeout": 5,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "triggerActivities": "in_vehicle, on_bicycle, on_foot, running, walking",
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "url": "http:\/\/yourserver.com\/locations",
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "useSignificantChangesOnly": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "enabled": true,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "schedulerEnabled": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "trackingMode": 1,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "odometer": 0,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "isFirstBoot": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "didLaunchInBackground": false,
06-30 18:04:44.815 24323 24415 I TSLocationManager:   "didDeviceReboot": false
06-30 18:04:44.815 24323 24415 I TSLocationManager: }
06-30 18:04:44.816 24323 24415 I TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 
06-30 18:04:44.816 24323 24415 I TSLocationManager: ╔═════════════════════════════════════════════
06-30 18:04:44.816 24323 24415 I TSLocationManager: ║ DEVICE SENSORS
06-30 18:04:44.816 24323 24415 I TSLocationManager: ╠═════════════════════════════════════════════
06-30 18:04:44.816 24323 24415 I TSLocationManager: ╟─ ✅  ACCELEROMETER: {Sensor name="LIS2DLC12 Accelerometer", vendor="STM", version=1, type=1, maxRange=78.4532, resolution=0.0023942017, power=0.15, minDelay=5000}
06-30 18:04:44.816 24323 24415 I TSLocationManager: ╟─ ⚠️  GYROSCOPE:  none.  Motion-detection system performance will be degraded
06-30 18:04:44.816 24323 24415 I TSLocationManager: ╟─ ✅  MAGNETOMETER: {Sensor name="AK09918C Magnetometer", vendor="Asahi Kasei Microdevices", version=2, type=2, maxRange=4900.02, resolution=0.06, power=1.1, minDelay=10000}
06-30 18:04:44.816 24323 24415 I TSLocationManager: ╟─ ✅  SIGNIFICANT_MOTION: {Sensor name="Significant Motion", vendor="Samsung Inc.", version=2, type=17, maxRange=1.0, resolution=1.0, power=0.16, minDelay=-1}
06-30 18:04:44.816 24323 24415 I TSLocationManager: ╚═════════════════════════════════════════════
06-30 18:04:45.221 24323 24323 D TSLocationManager: [c.t.l.l.LifecycleManager onCreate] ☯️  onCreate
06-30 18:04:45.223 24323 24323 D TSLocationManager: [c.t.l.l.LifecycleManager onStart] ☯️  onStart
06-30 18:04:45.224 24323 24323 D TSLocationManager: [c.t.l.l.LifecycleManager onResume] ☯️  onResume
06-30 18:04:45.226 24323 24323 I TSLocationManager: [c.t.l.a.BackgroundGeolocation <init>] 
06-30 18:04:45.226 24323 24323 I TSLocationManager:   ✅  Google Play Services: connected (version code:12451000)
06-30 18:04:45.238 24323 24323 D TSLocationManager: [c.t.l.http.HttpService startMonitoringConnectivityChanges] 
06-30 18:04:45.238 24323 24323 D TSLocationManager:   🎾  Start monitoring connectivity changes
06-30 18:04:45.261 24323 24323 I TSLocationManager: [c.t.l.p.TSProviderManager startMonitoring] 
06-30 18:04:45.261 24323 24323 I TSLocationManager:   🎾  Start monitoring location-provider changes
06-30 18:04:45.262 24323 24377 D TSLocationManager: [c.t.l.http.HttpService a] 
06-30 18:04:45.262 24323 24377 D TSLocationManager: ╔═════════════════════════════════════════════
06-30 18:04:45.262 24323 24377 D TSLocationManager: ║ 📶  Connectivity change: connected? true
06-30 18:04:45.262 24323 24377 D TSLocationManager: ╠═════════════════════════════════════════════
06-30 18:04:45.286 24323 24415 D TSLocationManager: [c.t.l.data.sqlite.b prune] 
06-30 18:04:45.286 24323 24415 D TSLocationManager:   ℹ️  PRUNE -1 days
06-30 18:04:51.374 24323 24323 I TSLocationManager: [c.t.l.s.TSScheduleManager oneShot] 
06-30 18:04:51.374 24323 24323 I TSLocationManager:   ⏰ Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
06-30 18:04:53.860 24323 24422 D TSLocationManager: [c.t.l.adapter.TSConfig d] ℹ️   Persist config, dirty: [autoSync, backgroundPermissionRationale, backgroundPermissionRationale.title, backgroundPermissionRationale.message, backgroundPermissionRationale.positiveAction, backgroundPermissionRationale.negativeAction, debug, desiredAccuracy, headlessJobService, logLevel, motionTriggerDelay, startOnBoot, stopOnTerminate, url]
06-30 18:04:53.872 24323 24422 D TSLocationManager: [c.t.locationmanager.util.c g] 
06-30 18:04:53.872 24323 24422 D TSLocationManager:   ℹ️  LocationAuthorization: Permission granted
06-30 18:04:53.874 24323 24415 I TSLocationManager: - Enable: true → true, trackingMode: 1
06-30 18:04:53.882 24323 24415 D TSLocationManager: [c.t.l.http.HttpService startMonitoringConnectivityChanges] 
06-30 18:04:53.882 24323 24415 D TSLocationManager:   🎾  Start monitoring connectivity changes
06-30 18:04:53.886 24323 24415 D TSLocationManager: [c.t.l.device.DeviceSettings startMonitoringPowerSaveChanges] 
06-30 18:04:53.886 24323 24415 D TSLocationManager:   🎾  Start monitoring powersave changes
06-30 18:04:53.891 24323 24415 D TSLocationManager: [c.t.locationmanager.util.c h] 
06-30 18:04:53.891 24323 24415 D TSLocationManager:   ℹ️  LocationAuthorization: Permission granted
06-30 18:04:53.892 24323 24415 I TSLocationManager: [c.t.l.service.HeartbeatService stop] 
06-30 18:04:53.892 24323 24415 I TSLocationManager:   🔴  Stop heartbeat
06-30 18:04:53.937 24323 24323 D TSLocationManager: [c.t.l.service.AbstractService start] 
06-30 18:04:53.937 24323 24323 D TSLocationManager:   🎾  LocationRequestService [eventCount: 1]
06-30 18:04:53.940 24323 24415 I TSLocationManager: [c.t.l.l.SingleLocationRequest startUpdatingLocation] 
06-30 18:04:53.940 24323 24415 I TSLocationManager:   🔵  [SingleLocationRequest start, action: 1, requestId: 1]
06-30 18:04:53.957 24323 24415 E TSLocationManager: [c.t.l.a.BackgroundGeolocation$w0 uncaughtException] 
06-30 18:04:53.957 24323 24415 E TSLocationManager:   ‼️  Uncaught Exception: Found interface com.google.android.gms.location.FusedLocationProviderClient, but class was expected (declaration of 'com.google.android.gms.location.FusedLocationProviderClient' appears in /data/app/~~QeKmFDtBclbKs3uysA_DnA==/com.tebapp-5LTy-Pz5Q9RHcK6mMZdALQ==/base.apk!classes9.dex)
06-30 18:04:53.957 24323 24415 E TSLocationManager: {"activityRecognitionInterval":10000,"allowIdenticalLocations":false,"authorization":{},"autoSync":false,"autoSyncThreshold":0,"backgroundPermissionRationale":{"title":"Allow Teb cloud sales to access to this device's location in the background?","message":"In order to track your activity in the background, please enable Allow all the time location permission","positiveAction":"Change to Allow all the time","negativeAction":"Cancel"},"batchSync":false,"configUrl":"","debug":true,"deferTime":0,"desiredAccuracy":-1,"desiredOdometerAccuracy":100,"disableAutoSyncOnCellular":false,"disableElasticity":false,"disableLocationAuthorizationAlert":false,"disableMotionActivityUpdates":false,"disableProviderChangeRecord":false,"disableStopDetection":false,"distanceFilter":10,"elasticityMultiplier":1,"enableHeadless":false,"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,"maxRecordsToPersist":-1,"method":"POST","minimumActivityRecognitionConfidence":75,"motionTriggerDelay":1000,"notification":{"layout":"","title":"","text":"Location Service activated","color":"","channelName":"TSLocationManager","channelId":"","smallIcon":"","largeIcon":"","priority":0,"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":"http:\/\/yourserver.com\/locations","useSignificantChangesOnly":false,"enabled":true,"schedulerEnabled":false,"trackingMode":1,"odometer":0,"isFirstBoot":false,"didLaunchInBackground":false,"didDeviceReboot":false}
06-30 18:04:53.957 24323 24415 E TSLocationManager: java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.FusedLocationProviderClient, but class was expected (declaration of 'com.google.android.gms.location.FusedLocationProviderClient' appears in /data/app/~~QeKmFDtBclbKs3uysA_DnA==/com.tebapp-5LTy-Pz5Q9RHcK6mMZdALQ==/base.apk!classes9.dex)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at com.transistorsoft.xms.g.location.FusedLocationProviderClient.requestLocationUpdates(Unknown Source:70)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at com.transistorsoft.locationmanager.location.SingleLocationRequest.startUpdatingLocation(Unknown Source:129)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at com.transistorsoft.locationmanager.service.LocationRequestService.handleStartAction(Unknown Source:77)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at com.transistorsoft.locationmanager.service.LocationRequestService.access$200(Unknown Source:0)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at com.transistorsoft.locationmanager.service.LocationRequestService$a.run(Unknown Source:63)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at java.lang.Thread.run(Thread.java:1012)
06-30 18:04:56.124 24502 24551 D TSLocationManager: [c.t.l.l.TSSQLiteAppender$c run] 
06-30 18:04:56.124 24502 24551 D TSLocationManager:   ℹ️  Cleared logs older than 72 hours
06-30 18:04:56.124 24502 24537 D TSLocationManager: [c.t.l.logger.LoggerFacade$a a] PID: 2
06-30 18:04:56.126 24502 24537 I TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 
06-30 18:04:56.126 24502 24537 I TSLocationManager: ╔═════════════════════════════════════════════
06-30 18:04:56.126 24502 24537 I TSLocationManager: ║ TSLocationManager version: 3.4.0 (420)
06-30 18:04:56.126 24502 24537 I TSLocationManager: ╠═════════════════════════════════════════════
06-30 18:04:56.126 24502 24537 I TSLocationManager: ╟─ samsung SM-A135F @ 13 (react-native)
06-30 18:04:56.126 24502 24537 I TSLocationManager: {
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "activityRecognitionInterval": 10000,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "allowIdenticalLocations": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "authorization": {},
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "autoSync": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "autoSyncThreshold": 0,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "backgroundPermissionRationale": {
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "title": "Allow Teb cloud sales to access to this device's location in the background?",
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "message": "In order to track your activity in the background, please enable Allow all the time location permission",
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "positiveAction": "Change to Allow all the time",
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "negativeAction": "Cancel"
06-30 18:04:56.126 24502 24537 I TSLocationManager:   },
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "batchSync": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "configUrl": "",
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "debug": true,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "deferTime": 0,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "desiredAccuracy": -1,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "desiredOdometerAccuracy": 100,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "disableAutoSyncOnCellular": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "disableElasticity": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "disableLocationAuthorizationAlert": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "disableMotionActivityUpdates": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "disableProviderChangeRecord": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "disableStopDetection": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "distanceFilter": 10,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "elasticityMultiplier": 1,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "enableHeadless": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "enableTimestampMeta": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "extras": {},
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "fastestLocationUpdateInterval": -1,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "foregroundService": true,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "geofenceInitialTriggerEntry": true,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "geofenceModeHighAccuracy": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "geofenceProximityRadius": 1000,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "geofenceTemplate": "",
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "headers": {},
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "headlessJobService": "com.transistorsoft.rnbackgroundgeolocation.HeadlessTask",
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "heartbeatInterval": -1,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "httpRootProperty": "location",
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "httpTimeout": 60000,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "isMoving": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "locationAuthorizationRequest": "Always",
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "locationTemplate": "",
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "locationTimeout": 60,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "locationUpdateInterval": 1000,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "locationsOrderDirection": "ASC",
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "logLevel": 5,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "logMaxDays": 3,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "maxBatchSize": -1,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "maxDaysToPersist": 1,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "maxRecordsToPersist": -1,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "method": "POST",
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "minimumActivityRecognitionConfidence": 75,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "motionTriggerDelay": 1000,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "notification": {
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "layout": "",
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "title": "",
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "text": "Location Service activated",
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "color": "",
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "channelName": "TSLocationManager",
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "channelId": "",
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "smallIcon": "",
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "largeIcon": "",
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "priority": 0,
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "sticky": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "strings": {},
06-30 18:04:56.126 24502 24537 I TSLocationManager:     "actions": []
06-30 18:04:56.126 24502 24537 I TSLocationManager:   },
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "params": {},
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "persist": true,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "persistMode": 2,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "schedule": [],
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "scheduleUseAlarmManager": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "speedJumpFilter": 300,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "startOnBoot": true,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "stationaryRadius": 25,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "stopAfterElapsedMinutes": 0,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "stopOnStationary": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "stopOnTerminate": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "stopTimeout": 5,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "triggerActivities": "in_vehicle, on_bicycle, on_foot, running, walking",
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "url": "http:\/\/yourserver.com\/locations",
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "useSignificantChangesOnly": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "enabled": true,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "schedulerEnabled": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "trackingMode": 1,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "odometer": 0,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "isFirstBoot": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "didLaunchInBackground": false,
06-30 18:04:56.126 24502 24537 I TSLocationManager:   "didDeviceReboot": false
06-30 18:04:56.126 24502 24537 I TSLocationManager: }
06-30 18:04:56.128 24502 24537 I TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 
06-30 18:04:56.128 24502 24537 I TSLocationManager: ╔═════════════════════════════════════════════
06-30 18:04:56.128 24502 24537 I TSLocationManager: ║ DEVICE SENSORS
06-30 18:04:56.128 24502 24537 I TSLocationManager: ╠═════════════════════════════════════════════
06-30 18:04:56.128 24502 24537 I TSLocationManager: ╟─ ✅  ACCELEROMETER: {Sensor name="LIS2DLC12 Accelerometer", vendor="STM", version=1, type=1, maxRange=78.4532, resolution=0.0023942017, power=0.15, minDelay=5000}
06-30 18:04:56.128 24502 24537 I TSLocationManager: ╟─ ⚠️  GYROSCOPE:  none.  Motion-detection system performance will be degraded
06-30 18:04:56.128 24502 24537 I TSLocationManager: ╟─ ✅  MAGNETOMETER: {Sensor name="AK09918C Magnetometer", vendor="Asahi Kasei Microdevices", version=2, type=2, maxRange=4900.02, resolution=0.06, power=1.1, minDelay=10000}
06-30 18:04:56.128 24502 24537 I TSLocationManager: ╟─ ✅  SIGNIFICANT_MOTION: {Sensor name="Significant Motion", vendor="Samsung Inc.", version=2, type=17, maxRange=1.0, resolution=1.0, power=0.16, minDelay=-1}
06-30 18:04:56.128 24502 24537 I TSLocationManager: ╚═════════════════════════════════════════════
06-30 18:04:56.129 24502 24537 D TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 
06-30 18:04:56.129 24502 24537 D TSLocationManager:   🎾  LocationRequestService [eventCount: 1]
06-30 18:04:56.130 24502 24537 E TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 
06-30 18:04:56.130 24502 24537 E TSLocationManager:   ‼️  Failed to find SingleLocationRequest in START action; requestId: 1; Intent: Intent { act=start cmp=com.tebapp/com.transistorsoft.locationmanager.service.LocationRequestService (has extras) }
06-30 18:04:56.130 24502 24537 D TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: false]
06-30 18:04:56.131 24502 24537 D TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ⚙️︎  finish LocationRequestService [eventCount: 0, sticky: false]
06-30 18:04:56.132 24502 24537 D TSLocationManager: [c.t.l.logger.LoggerFacade$a a] ☯️  onCreate
06-30 18:04:56.132 24502 24537 I TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 
06-30 18:04:56.132 24502 24537 I TSLocationManager:   ✅  Google Play Services: connected (version code:12451000)
06-30 18:04:56.133 24502 24537 D TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 
06-30 18:04:56.133 24502 24537 D TSLocationManager:   🎾  Start monitoring connectivity changes
06-30 18:04:56.133 24502 24537 D TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 
06-30 18:04:56.133 24502 24537 D TSLocationManager: ╔═════════════════════════════════════════════
06-30 18:04:56.133 24502 24537 D TSLocationManager: ║ ☯️  HeadlessMode? true
06-30 18:04:56.133 24502 24537 D TSLocationManager: ╠═════════════════════════════════════════════
06-30 18:04:56.134 24502 24537 I TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 
06-30 18:04:56.134 24502 24537 I TSLocationManager:   🎾  Start monitoring location-provider changes
06-30 18:04:56.135 24502 24537 D TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 
06-30 18:04:56.135 24502 24537 D TSLocationManager: ╔═════════════════════════════════════════════
06-30 18:04:56.135 24502 24537 D TSLocationManager: ║ 📶  Connectivity change: connected? true
06-30 18:04:56.135 24502 24537 D TSLocationManager: ╠═════════════════════════════════════════════
06-30 18:04:56.136 24502 24537 D TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 
06-30 18:04:56.136 24502 24537 D TSLocationManager:   ℹ️  PRUNE -1 days
06-30 18:04:56.136 24502 24537 D TSLocationManager: [c.t.l.logger.LoggerFacade$a a] 
06-30 18:04:56.136 24502 24537 D TSLocationManager:   🔴  LocationRequestService stopped
@Shahaab-1
Copy link
Author

Found the issue this was not added in android/app/build.gradle implementation 'com.google.android.gms:play-services-location:21.0.1'

@Shahaab-1 Shahaab-1 changed the title After configuring with const state = await BackgroundGeolocation.ready(config) getting false in state.enabled Android app crashes when using backgroundgeolocation.start() Jun 30, 2023
@christocracy
Copy link
Member

christocracy commented Jun 30, 2023

It is well-known that play-services-location made a breaking change in v21.

java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.FusedLocationProviderClient, but class was expected (declaration of 'com.google.android.gms.location.FusedLocationProviderClient' appears in /data/app/~~QeKmFDtBclbKs3uysA_DnA==/com.tebapp-5LTy-Pz5Q9RHcK6mMZdALQ==/base.apk!classes9.dex)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at com.transistorsoft.xms.g.location.FusedLocationProviderClient.requestLocationUpdates(Unknown Source:70)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at com.transistorsoft.locationmanager.location.SingleLocationRequest.startUpdatingLocation(Unknown Source:129)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at com.transistorsoft.locationmanager.service.LocationRequestService.handleStartAction(Unknown Source:77)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at com.transistorsoft.locationmanager.service.LocationRequestService.access$200(Unknown Source:0)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at com.transistorsoft.locationmanager.service.LocationRequestService$a.run(Unknown Source:63)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
06-30 18:04:53.957 24323 24415 E TSLocationManager:     at java.lang.Thread.run(Thread.java:1012)

See #1710

There are smarter ways to control the googlePlayServicesLocationVersion using ext vars in android/build.gradle.

@christocracy
Copy link
Member

christocracy commented Jun 30, 2023

The googlePlayServicesLocationVersion ext variable ultimately ends up inside the plugin's own build.gradle here

@christocracy
Copy link
Member

Searching the issues here for "IncompatibleClassChangeError", you would find these results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants