Software Archive
Read-only legacy content
17061 Discussions

Background geolocation crashes app in debug

Brandt__Lars
New Contributor I
570 Views

Hi

I know you can't do support for third party plugins, but is there anyway to find out why it crashes?

 

Problem description:

Works fine in actual app, but crashes in debug via App Preview when calling backgroundGeolocation.start().

plugin:

id="cordova-plugin-mauron85-background-geolocation"

version="2.1.2">

Thanks

Lars B.

0 Kudos
2 Replies
Brandt__Lars
New Contributor I
570 Views

Sorry, edit function does not work, so had to do this in a new post:

Code to reproduce:

var callbackFn = function(location) {         
                
                /*
                IMPORTANT:  You must execute the finish method here to inform the native plugin that you're finished,
                and the background-task may be completed.  You must do this regardless if your HTTP request is successful or not.
                IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
                */
                backgroundGeoLocation.finish();
            };
            var failureFn = function(error) {
                  console.log('BackgroundGeoLocation error');
            };
                        
            var config = {
                desiredAccuracy: 0,
                stationaryRadius: 0,
                distanceFilter: 1,
                startForeground: true,
                locationProvider: 0, // 0 => ANDROID_DISTANCE_FILTER_PROVIDER | 1 => ANDROID_ACTIVITY_PROVIDER
                  interval: 1000,
                  fastestInterval: 500,
                  activitiesInterval: 1000,
                activityType: 'AutomotiveNavigation',
                debug: VD_XDK_GPS_SHOW_DEBUG, //enable this hear sounds for background-geolocation life-cycle.
                stopOnTerminate: false //enable this to clear background location settings when the app terminates
            };
            backgroundGeoLocation.configure(callbackFn, failureFn, config);
            backgroundGeoLocation.start(); 

0 Kudos
PaulF_IntelCorp
Employee
570 Views

I'm assuming you mean it crashes when you use the Debug tab? Because App Preview doesn't support that plugin. Not sure why it would cause a custom debug module to fail, but that method is not fool-proof, there are some things that simply do not work except in a built app, and this may be one of them. If you need to do some debugging with the app, you can always debug the built app with a USB cable and remote CDT. See this doc page for some help > https://software.intel.com/en-us/xdk/docs/intel-xdk-debug-and-test-overview#RemoteChromeDevTools <

0 Kudos
Reply