Cordova-plugin-background-geolocation: NullPointerException: onTaskRemoved (LocationService.java:199)

Created on 22 Mar 2017  路  26Comments  路  Source: mauron85/cordova-plugin-background-geolocation

Exception reported on google play. No feedback from the user unfortunately. If I manage to reproduce it or get more info I'll update the issue.

Your Environment

  • Plugin version: 2.2.5
  • Platform: Android
  • OS version: 5.0.2
  • Device manufacturer and model: Sony C6916
  • Cordova version (cordova -v): 6.4.0
  • Cordova platform version (cordova platform ls): 6.0.0
  • Plugin configuration options:
  • Link to your project:

Debug logs

Exception java.lang.RuntimeException: Unable to start service com.marianhello.bgloc.LocationService@3fef4865 with Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 }: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Boolean com.marianhello.bgloc.Config.getStopOnTerminate()' on a null object reference

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Boolean com.marianhello.bgloc.Config.getStopOnTerminate()' on a null object reference
com.marianhello.bgloc.LocationService.onTaskRemoved (LocationService.java:199)
android.app.ActivityThread.handleServiceArgs (ActivityThread.java:2920)
android.app.ActivityThread.access$2100 (ActivityThread.java:149)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1422)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:211)
android.app.ActivityThread.main (ActivityThread.java:5317)
java.lang.reflect.Method.invoke (Method.java)
java.lang.reflect.Method.invoke (Method.java:372)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1016)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:811)

android bug

All 26 comments

Yes, this seems like a bug here https://github.com/mauron85/cordova-plugin-background-geolocation/blob/master/android/plugin/src/main/java/com/marianhello/bgloc/LocationService.java#L199

It probably happens when user terminates app before starting service with backgroundGeolocation.start()

Notice: this issue has been closed because it has been reported for branch 2.x or later. It could be already fixed in v3 or is not relevant anymore. You may reopen this issue if it has been closed in error.

@mauron85 I just integrated this plugin on your master branch (so 3.0.0-alpha.15), and I have this exact problem. It happens when I quit my application. The background service is already running (I can see the icon), but when I quit I think there's a race condition where it exits one service and tries to start a new one immediately after, because in android studio logcat I get a new process ID and only these logs for the new application. Do I need to call .stop() somehow when my application is quitting?

03-09 12:46:09.686 4352-4352/? E/Zygote: v2
03-09 12:46:09.686 4352-4352/? I/libpersona: KNOX_SDCARD checking this for 10182
03-09 12:46:09.686 4352-4352/? I/libpersona: KNOX_SDCARD not a persona
03-09 12:46:09.688 4352-4352/? E/Zygote: accessInfo : 0
03-09 12:46:09.689 4352-4352/? W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2],  Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0009, [-1 -1 -1 -1 0 1]
03-09 12:46:09.692 4352-4352/? I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.smrtsystems.mobile 
03-09 12:46:09.698 4352-4352/? I/art: Late-enabling -Xcheck:jni
03-09 12:46:09.720 4352-4352/? D/TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service
03-09 12:46:09.781 4352-4352/com.smrtsystems.mobile V/TelemetryService: Create event.
03-09 12:46:09.783 4352-4352/com.smrtsystems.mobile V/TelemetryService: Task removed event.
03-09 12:46:09.783 4352-4352/com.smrtsystems.mobile V/TelemetryService: Unregistering location receiver.
03-09 12:46:09.806 4352-4352/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Creating LocationService
03-09 12:46:09.819 4352-4352/com.smrtsystems.mobile D/com.marianhello.bgloc.LocationService: Task has been removed
03-09 12:46:09.821 4352-4352/com.smrtsystems.mobile D/AndroidRuntime: Shutting down VM
03-09 12:46:09.821 4352-4386/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Network condition changed hasConnectivity: true
03-09 12:46:09.822 4352-4352/com.smrtsystems.mobile E/AndroidRuntime: FATAL EXCEPTION: main
                                                                      Process: com.smrtsystems.mobile, PID: 4352
                                                                      java.lang.RuntimeException: Unable to start service com.marianhello.bgloc.LocationService@251c0eb with Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.smrtsystems.mobile/.MainActivity launchParam=MultiScreenLaunchParams { mDisplayId=0 mBaseDisplayId=0 mFlags=0 } (has extras) }: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Boolean com.marianhello.bgloc.Config.getStopOnTerminate()' on a null object reference
                                                                          at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3758)
                                                                          at android.app.ActivityThread.-wrap23(ActivityThread.java)
                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1747)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                          at android.os.Looper.loop(Looper.java:154)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:6776)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
                                                                       Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Boolean com.marianhello.bgloc.Config.getStopOnTerminate()' on a null object reference
                                                                          at com.marianhello.bgloc.LocationService.onTaskRemoved(LocationService.java:215)
                                                                          at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3743)
                                                                          at android.app.ActivityThread.-wrap23(ActivityThread.java)聽
                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1747)聽
                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)聽
                                                                          at android.os.Looper.loop(Looper.java:154)聽
                                                                          at android.app.ActivityThread.main(ActivityThread.java:6776)聽
                                                                          at java.lang.reflect.Method.invoke(Native Method)聽
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)聽
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)聽

Device is Galaxy J3 (2017) with android 7.0.

Also I have this configuration:

            debug: false,
            startOnBoot: false,
            stopOnTerminate: true,

Changing stopOnTerminate to false has no effect, still same crash.

@baversjo thank you for your report.
Can you restart device and try to configure and start plugin with optionstopOnTeminate: true?

03-09 12:46:09.806 4352-4352/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Creating LocationService
03-09 12:46:09.819 4352-4352/com.smrtsystems.mobile D/com.marianhello.bgloc.LocationService: Task has been removed

this lines are very strange. Creating service and immediately calling onTaskRemoved even before service was started.

@baversjo Can you provide relevant js source code? Where are you configuring, starting, stoping service

@mauron85
I attempted your first test, restarted device, called configure and start. On app close (I swipe the app away), I still get the crash 1-2 seconds after the app has closed. So same behavior as before.

I was thinking, maybe this was a compatibility problem with cordova-plugin-background-mode, but after disabling cordova.plugins.backgroundMode.enable();, I'm still observing the same behavior.

I am starting the service deep inside my cordova app, we don't call startWatching until the user has signed in to our app. Point being, it's called long after starting the app. I've removed the code that calls .stop(), thinking it could be the cause (but it's not). I've also verified "start watching for location!" only happens once. So really, here's all relevant code:

    startWatching() {
        console.log('start watching for location!');
        BackgroundGeolocation.configure({
            desiredAccuracy: BackgroundGeolocation.MEDIUM_ACCURACY, /* increase to HIGH_ACCURACY in case users complain */
            locationProvider: BackgroundGeolocation.RAW_PROVIDER,
            distanceFilter: 0,
            interval: 20000,
            notificationTitle: 'Background Tracking Running',
            notificationText: '',
            debug: false,
            startOnBoot: false,
            stopOnTerminate: true,
        });

        BackgroundGeolocation.start();
        BackgroundGeolocation.on('location', (location) => this._onLocationAvailable(location));
        BackgroundGeolocation.on('error', (error) => this._onLocationError(error));


        return LocationPlugin.success();
    }

By the way, the reason I'm using RAW_PROVIDER and distanceFilter:0 is because I have my own logic for detecting movement.

Lastly, to remove any concern about my configuration, completely removed the call to .configure({}) , so I really only call .start() with all the defaults. I uninstalled the app so any saved settings wouldn't stay, meaning I'm able to reproduce this with only a call to BackgroundGeolocation.start() and nothing else.

@baversjo that's very strange. Especially considering using stopOnTerminate: true and also stopping service with BackgroundGeolocation.stop();. In this case service should be stopped on app terminate and never restarted automatically.

Can you confirm following "crash" flow:

  1. started app
  2. configured (with stopOnTerminate: true)
  3. started tracking with BackgroundGeolocation.start();
  4. killed app by swiping it from app list
  5. after 1-2 sec you get the crash

Also can you please send me larger chunk of log with all above steps being logged (meaning just record adb output and do all the steps from the flow). Thx

@mauron85 interesting, so this bug could be due to a discrepancy with samsung devices? ...
Thanks for looking into it.

I can confirm those are the exact steps, will try to get you the logs for the previous steps ASAP. I have a practical problem in getting the logs from when the first process shutdown though; android studio seems to clear them when the new, "non intentional" process starts. The logs I posted are from the new process, but I will try to get them from the previous process (the one the user actually kills...)

@baversjo use android command line tools. You can log from terminal directly to file:

adb logcat -f log.txt

Docs https://developer.android.com/studio/command-line/logcat.html

@mauron85
Thanks, just needed to find the PID to filter logcat by it :)
First, I press the app switcher, I get the following logs:

03-09 18:32:40.255  2827  4063 D InputDispatcher: Focus left window: 27349
03-09 18:32:40.256 27349 27349 D ViewRootImpl@dbd09a[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0
03-09 18:32:40.258 27349 27349 D CordovaActivity: Paused the activity.
03-09 18:32:40.258 27349 27349 I com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App will be paused multitasking=true
03-09 18:32:40.320 27349 27349 D CordovaActivity: Stopped the activity.
03-09 18:32:40.320 27349 27349 I com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App is no longer visible
03-09 18:32:40.345 27349 27349 D ViewRootImpl@dbd09a[MainActivity]: mHardwareRenderer.destroy()#1
03-09 18:32:40.350 27349 27349 D ViewRootImpl@dbd09a[MainActivity]: Relayout returned: oldFrame=[0,0][720,1280] newFrame=[0,0][720,1280] result=0x5 surface={isValid=false 0} surfaceGenerationChanged=true
03-09 18:32:40.476 27349 27349 D ViewRootImpl@dbd09a[MainActivity]: mHardwareRenderer.destroy()#1
03-09 18:32:40.489 27349 27349 D ViewRootImpl@dbd09a[MainActivity]: Relayout returned: oldFrame=[0,0][720,1280] newFrame=[0,0][720,1280] result=0x1 surface={isValid=false 0} surfaceGenerationChanged=false
03-09 18:32:40.489 27349 27349 D InputTransport: Input channel destroyed: fd=196

Then, I swipe the app away to delete it, I get the following logs:

03-09 18:32:45.396 27349 27349 D CordovaActivity: CordovaActivity.onDestroy()
03-09 18:32:45.397 27349 27349 I Process : Sending signal. PID: 27349 SIG: 9
03-09 18:32:45.561  2827  4061 I ActivityManager: Process com.smrtsystems.mobile (pid 27349) has died(282,611)
03-09 18:32:45.561  2827  4061 D ActivityManager: cleanUpApplicationRecord -- 27349

Then, the new process logs (as mentioned above):

03-09 18:34:37.981 28724-28724/? E/Zygote: v2
03-09 18:34:37.981 28724-28724/? I/libpersona: KNOX_SDCARD checking this for 10185
03-09 18:34:37.981 28724-28724/? I/libpersona: KNOX_SDCARD not a persona
03-09 18:34:37.982 28724-28724/? E/Zygote: accessInfo : 0
03-09 18:34:37.983 28724-28724/? W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2],  Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0009, [-1 -1 -1 -1 0 1]
03-09 18:34:37.986 28724-28724/? I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.smrtsystems.mobile 
03-09 18:34:37.990 28724-28724/? I/art: Late-enabling -Xcheck:jni
03-09 18:34:38.011 28724-28724/com.smrtsystems.mobile D/TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service
03-09 18:34:38.083 28724-28724/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Creating LocationService
03-09 18:34:38.097 28724-28724/com.smrtsystems.mobile D/com.marianhello.bgloc.LocationService: Task has been removed
03-09 18:34:38.099 28724-28724/com.smrtsystems.mobile D/AndroidRuntime: Shutting down VM
03-09 18:34:38.099 28724-28740/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Network condition changed hasConnectivity: true
03-09 18:34:38.100 28724-28724/com.smrtsystems.mobile E/AndroidRuntime: FATAL EXCEPTION: main
                                                                        Process: com.smrtsystems.mobile, PID: 28724
                                                                        java.lang.RuntimeException: Unable to start service com.marianhello.bgloc.LocationService@e24fbd0 with Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.smrtsystems.mobile/.MainActivity launchParam=MultiScreenLaunchParams { mDisplayId=0 mBaseDisplayId=0 mFlags=0 } (has extras) }: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Boolean com.marianhello.bgloc.Config.getStopOnTerminate()' on a null object reference
                                                                            at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3758)
                                                                            at android.app.ActivityThread.-wrap23(ActivityThread.java)
                                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1747)
                                                                            at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                            at android.os.Looper.loop(Looper.java:154)
                                                                            at android.app.ActivityThread.main(ActivityThread.java:6776)
                                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
                                                                         Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Boolean com.marianhello.bgloc.Config.getStopOnTerminate()' on a null object reference
                                                                            at com.marianhello.bgloc.LocationService.onTaskRemoved(LocationService.java:215)
                                                                            at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3743)
                                                                            at android.app.ActivityThread.-wrap23(ActivityThread.java)聽
                                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1747)聽
                                                                            at android.os.Handler.dispatchMessage(Handler.java:102)聽
                                                                            at android.os.Looper.loop(Looper.java:154)聽
                                                                            at android.app.ActivityThread.main(ActivityThread.java:6776)聽
                                                                            at java.lang.reflect.Method.invoke(Native Method)聽
                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)聽
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)聽

also @mauron85 to clarify, I never call .stop() on CordovaActivity.onDestroy(). I'm not sure how I would do this from a js context.... But we don't have to do that with stopOnTerminate I assume.

@baversjo yes there is no need to call stop from js context. I think I understand what causes the crash and prepare workaround for you to test.

@baversjo can you plz try [email protected]

@mauron85 Ugh I can't because I need #381 .. Maybe you could merge that PR in to master or to this branch only? Because I get this error, not sure how to workaround without having that PR:

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
    at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)

@baversjo there are some issues with #381. You can temporarily override version. Read my comment

https://github.com/mauron85/cordova-plugin-background-geolocation/issues/380#issuecomment-371926142

@mauron85 thanks. Now it compiled.. But I still got the error :(
Swipe to kill:

03-10 14:59:58.971 30644 30644 D CordovaActivity: CordovaActivity.onDestroy()
03-10 14:59:58.972 30644 30644 I Process : Sending signal. PID: 30644 SIG: 9
03-10 14:59:59.165  2827  3696 I ActivityManager: Process com.smrtsystems.mobile (pid 30644) has died(221,638)
03-10 14:59:59.165  2827  3696 D ActivityManager: cleanUpApplicationRecord -- 30644

new, rouge process:

03-10 15:00:00.181 30880-30880/? E/Zygote: v2
03-10 15:00:00.181 30880-30880/? I/libpersona: KNOX_SDCARD checking this for 10187
03-10 15:00:00.181 30880-30880/? I/libpersona: KNOX_SDCARD not a persona
03-10 15:00:00.183 30880-30880/? E/Zygote: accessInfo : 0
03-10 15:00:00.183 30880-30880/? W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2],  Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0009, [-1 -1 -1 -1 0 1]
03-10 15:00:00.185 30880-30880/? I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.smrtsystems.mobile 
03-10 15:00:00.190 30880-30880/? I/art: Late-enabling -Xcheck:jni
03-10 15:00:00.210 30880-30880/com.smrtsystems.mobile D/TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service
03-10 15:00:00.272 30880-30880/com.smrtsystems.mobile V/TelemetryService: Create event.
03-10 15:00:00.274 30880-30880/com.smrtsystems.mobile V/TelemetryService: Task removed event.
03-10 15:00:00.274 30880-30880/com.smrtsystems.mobile V/TelemetryService: Unregistering location receiver.
03-10 15:00:00.300 30880-30880/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Creating LocationService
03-10 15:00:00.319 30880-30880/com.smrtsystems.mobile D/com.marianhello.bgloc.LocationService: Task has been removed
03-10 15:00:00.321 30880-30896/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Network condition changed hasConnectivity: true
03-10 15:00:00.321 30880-30880/com.smrtsystems.mobile D/AndroidRuntime: Shutting down VM
03-10 15:00:00.322 30880-30880/com.smrtsystems.mobile E/AndroidRuntime: FATAL EXCEPTION: main
                                                                        Process: com.smrtsystems.mobile, PID: 30880
                                                                        java.lang.RuntimeException: Unable to start service com.marianhello.bgloc.LocationService@4a6f1ef with Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.smrtsystems.mobile/.MainActivity launchParam=MultiScreenLaunchParams { mDisplayId=0 mBaseDisplayId=0 mFlags=0 } (has extras) }: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Boolean com.marianhello.bgloc.Config.getStopOnTerminate()' on a null object reference
                                                                            at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3758)
                                                                            at android.app.ActivityThread.-wrap23(ActivityThread.java)
                                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1747)
                                                                            at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                            at android.os.Looper.loop(Looper.java:154)
                                                                            at android.app.ActivityThread.main(ActivityThread.java:6776)
                                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
                                                                         Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Boolean com.marianhello.bgloc.Config.getStopOnTerminate()' on a null object reference
                                                                            at com.marianhello.bgloc.LocationService.onTaskRemoved(LocationService.java:215)
                                                                            at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3743)
                                                                            at android.app.ActivityThread.-wrap23(ActivityThread.java)聽
                                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1747)聽
                                                                            at android.os.Handler.dispatchMessage(Handler.java:102)聽
                                                                            at android.os.Looper.loop(Looper.java:154)聽
                                                                            at android.app.ActivityThread.main(ActivityThread.java:6776)聽
                                                                            at java.lang.reflect.Method.invoke(Native Method)聽
                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)聽
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)聽

To verify that I had your test version installed, I went to plugins/cordova-plugin-mauron85-background-geolocation/package.json, and I see the id:
"_id": "[email protected]",

Check again if alpha.16 is installed. It could not crash on line 215 anymore as it's comment now :)

https://github.com/mauron85/background-geolocation-android/blob/issue/276/src/main/java/com/marianhello/bgloc/LocationService.java#L215

@mauron85 you got me ;)
However we have a new crash!

03-10 16:31:05.821 6286-6286/com.smrtsystems.mobile E/Zygote: v2
03-10 16:31:05.821 6286-6286/com.smrtsystems.mobile I/libpersona: KNOX_SDCARD checking this for 10187
03-10 16:31:05.821 6286-6286/com.smrtsystems.mobile I/libpersona: KNOX_SDCARD not a persona
03-10 16:31:05.822 6286-6286/com.smrtsystems.mobile E/Zygote: accessInfo : 0
03-10 16:31:05.824 6286-6286/com.smrtsystems.mobile W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2],  Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0009, [-1 -1 -1 -1 0 1]
03-10 16:31:05.826 6286-6286/com.smrtsystems.mobile I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.smrtsystems.mobile 
03-10 16:31:05.830 6286-6286/com.smrtsystems.mobile I/art: Late-enabling -Xcheck:jni
03-10 16:31:05.847 6286-6286/com.smrtsystems.mobile D/TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service
03-10 16:31:05.916 6286-6286/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Creating LocationService
03-10 16:31:05.931 6286-6286/com.smrtsystems.mobile D/com.marianhello.bgloc.LocationService: Task has been removed
03-10 16:31:05.932 6286-6302/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Network condition changed hasConnectivity: true
03-10 16:31:05.934 6286-6286/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Stopping self
03-10 16:31:05.937 6286-6286/com.smrtsystems.mobile V/TelemetryService: Create event.
03-10 16:31:05.938 6286-6286/com.smrtsystems.mobile V/TelemetryService: Task removed event.
03-10 16:31:05.938 6286-6286/com.smrtsystems.mobile V/TelemetryService: Unregistering location receiver.
03-10 16:31:05.939 6286-6286/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Destroying LocationService
03-10 16:31:05.940 6286-6286/com.smrtsystems.mobile D/AndroidRuntime: Shutting down VM
03-10 16:31:05.941 6286-6286/com.smrtsystems.mobile E/AndroidRuntime: FATAL EXCEPTION: main
                                                                      Process: com.smrtsystems.mobile, PID: 6286
                                                                      java.lang.RuntimeException: Unable to stop service com.marianhello.bgloc.LocationService@e24fbd0: java.lang.NullPointerException: Attempt to invoke interface method 'void com.marianhello.bgloc.LocationProvider.onDestroy()' on a null object reference
                                                                          at android.app.ActivityThread.handleStopService(ActivityThread.java:3788)
                                                                          at android.app.ActivityThread.-wrap30(ActivityThread.java)
                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1752)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                          at android.os.Looper.loop(Looper.java:154)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:6776)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
                                                                       Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void com.marianhello.bgloc.LocationProvider.onDestroy()' on a null object reference
                                                                          at com.marianhello.bgloc.LocationService.onDestroy(LocationService.java:199)
                                                                          at android.app.ActivityThread.handleStopService(ActivityThread.java:3771)
                                                                          at android.app.ActivityThread.-wrap30(ActivityThread.java)聽
                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1752)聽
                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)聽
                                                                          at android.os.Looper.loop(Looper.java:154)聽
                                                                          at android.app.ActivityThread.main(ActivityThread.java:6776)聽
                                                                          at java.lang.reflect.Method.invoke(Native Method)聽
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)聽
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)聽

ok will add another conditional check in onDestroy method.

ok. can you please try [email protected]?

@mauron85 thank you so much,
now it works. Log:

03-10 19:50:52.786 15872-15872/? E/Zygote: v2
03-10 19:50:52.786 15872-15872/? I/libpersona: KNOX_SDCARD checking this for 10187
03-10 19:50:52.786 15872-15872/? I/libpersona: KNOX_SDCARD not a persona
03-10 19:50:52.788 15872-15872/? E/Zygote: accessInfo : 0
03-10 19:50:52.788 15872-15872/? W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2],  Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0009, [-1 -1 -1 -1 0 1]
03-10 19:50:52.790 15872-15872/? I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.smrtsystems.mobile 
03-10 19:50:52.796 15872-15872/? I/art: Late-enabling -Xcheck:jni
03-10 19:50:52.820 15872-15872/? D/TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service
03-10 19:50:52.877 15872-15872/com.smrtsystems.mobile V/TelemetryService: Create event.
03-10 19:50:52.879 15872-15872/com.smrtsystems.mobile V/TelemetryService: Task removed event.
03-10 19:50:52.879 15872-15872/com.smrtsystems.mobile V/TelemetryService: Unregistering location receiver.
03-10 19:50:52.904 15872-15872/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Creating LocationService
03-10 19:50:52.918 15872-15872/com.smrtsystems.mobile D/com.marianhello.bgloc.LocationService: Task has been removed
03-10 19:50:52.920 15872-15888/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Network condition changed hasConnectivity: true
03-10 19:50:52.925 15872-15872/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Stopping self
03-10 19:50:52.927 15872-15872/com.smrtsystems.mobile I/com.marianhello.bgloc.LocationService: Destroying LocationService

thx for assistence and glad to hear that. closing.

Was this page helpful?
0 / 5 - 0 ratings