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

Unable to create service com.transistorsoft.locationmanager.service.LocationRequestService: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Intent.setFlags(int)' on a null object reference

Open plell opened this issue 6 years ago • 2 comments

Your Environment

  • Plugin version: 3.4.2
  • Platform: Android
  • OS version: 9
  • Device manufacturer / model: Google Pixel 3
  • React Native version (react-native -v): 0.61.5
  • Plugin config
BackgroundGeolocation.ready({
      stopOnTerminate: false,
      startOnBoot: true,
      forceReloadOnBoot:true,
      foregroundService:true,
      preventSuspend:true,
      allowIdenticalLocations:true,
      url: 'https://flespi.io/mqtt/messages',
      locationTemplate: `{"payload":'{"user.id":"${userId}", "timestamp":"<%= timestamp %>","position.latitude":<%= latitude %>,"position.longitude":<%= longitude %>,"position.speed": <%= speed %>,"position.altitude": <%= altitude %>,"position.direction": <%= heading %>,"position.accuracy": <%= accuracy %>,"activity":"<%= activity.type %>","odometer":<%= odometer %>,"battery":<%= battery.level %>,"event":"<%= event %>"}'}`,
      geofenceTemplate: `{"payload":'{"geofence.identifier":"<%= geofence.identifier %>","geofence.action": "<%= geofence.action %>", "user.id":"${userId}", "timestamp": "<%= timestamp %>","position.latitude":<%= latitude %>,"position.longitude":<%= longitude %>,"position.speed": <%= speed %>,"position.altitude": <%= altitude %>,"position.direction": <%= heading %>,"position.accuracy": <%= accuracy %>,"activity":"<%= activity.type %>","odometer":<%= odometer %>,"battery":<%= battery.level %>,"event":"<%= event %>"}'}`,
      httpRootProperty:'.',
      params: {
        "topic": `messages/${ident}`,
        "type": 2
      },
      elasticityMultiplier:2,
      heartbeatInterval:300,
      scheduleUseAlarmManager: true,
    }

Expected Behavior

Object reference should not be null

Actual Behavior

App crashes

Steps to Reproduce

  1. run BackgroundGeolocation

Debug logs

Logs
02-26 15:02:24.657   803   856 D CHRE    : @ 361124.250: [ImuCal] Dynamic sensor configuration: high-performance.
02-26 15:02:24.661  6330  6330 D AndroidRuntime: Shutting down VM
02-26 15:02:24.662  6330  6330 E AndroidRuntime: FATAL EXCEPTION: main
02-26 15:02:24.662  6330  6330 E AndroidRuntime: Process: com.h2h.test, PID: 6330
02-26 15:02:24.662  6330  6330 E AndroidRuntime: java.lang.RuntimeException: Unable to create service com.transistorsoft.locationmanager.service.LocationRequestService: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Intent.setFlags(int)' on a null object reference
02-26 15:02:24.662  6330  6330 E AndroidRuntime: 	at android.app.ActivityThread.handleCreateService(ActivityThread.java:3582)

plell avatar Feb 27 '20 00:02 plell

Duplicate #951

christocracy avatar Feb 27 '20 00:02 christocracy

ah, yes. fixed, thanks!

plell avatar Feb 27 '20 01:02 plell