question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plugin not starting or .on('start') does not hit any way

See original GitHub issue

Your Environment

  • Plugin version: 3.0.6

  • Platform: Android

  • OS version: 9.0.0

  • Device manufacturer and model: Oneplus 6

  • Running in Simulator: NO

  • Cordova version (cordova -v): 9.0.0

  • Cordova platform version (cordova platform ls): android 8.0.0

  • Plugin configuration options:

BackgroundGeolocation.configure({
           locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER, //DISTANCE_FILTER_PROVIDER //ACTIVITY_PROVIDER
           desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
           stationaryRadius: 5,
           distanceFilter: 5,
           notificationTitle: 'Background tracking',
           notificationText: 'enabled',
           debug: true,
           interval: 10000, // 10 seconds => The minimum time interval between location updates in milliseconds. @see Android docs for more information.
           fastestInterval: 5000, // 5 seconds => Fastest rate in milliseconds at which your app can handle location updates. @see Android docs.
           activitiesInterval: 10000, // 10 seconds => Rate in milliseconds at which activity recognition occurs. Larger values will result in fewer activity detections while improving battery life.
           stopOnTerminate: false,
           notificationsEnabled: true,
           startForeground: true,
           url: ''
       });
  • Link to your project:

Context

Expected Behavior

Should hit this method:

       BackgroundGeolocation.on('start', function () {
           console.log('[INFO] BackgroundGeolocation service has been started');
       });

Actual Behavior

Nothing happening, not even the foreground notification showing up. No JS error logs on console what so ever

Possible Fix

Steps to Reproduce

  1. Copy paste the example on the plugin read me page (exactly)
  2. It starts the background location service using:
            if (!status.isRunning) {
                BackgroundGeolocation.start(); //triggers start on start event
            }
  1. These methods don’t get hit at all
      BackgroundGeolocation.on('location', function (location) {

          console.log("Got location: " + JSON.stringify(location));
          alert("Got location: " + JSON.stringify(location));

          // handle your locations here
          // to perform long running operation on iOS
          // you need to create background task
          BackgroundGeolocation.startTask(function (taskKey) {
              // execute long running task
              // eg. ajax post location
              // IMPORTANT: task has to be ended by endTask
              BackgroundGeolocation.endTask(taskKey);
          });
      });

      BackgroundGeolocation.on('error', function (error) {
          console.log('[ERROR] BackgroundGeolocation error:', error.code, error.message);
      });

      BackgroundGeolocation.on('start', function () {
          console.log('[INFO] BackgroundGeolocation service has been started');
      });

Context

Debug logs

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
khayargolicommented, Sep 23, 2019

IMPORTANT!!

Hi all,

I just found that if you have some tags like <edit-config> or <config-file> on your project’s config.xml file, then the plugin fails to start the geolocation i.e BackgroundGeolocation.start() never hits!!!

How to fix this ? @mauron85 Think the AndroidManifest.xml file is not being properly updated.

To reproduce just add a tag on your config.xml file like, my project has the following lines:

<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
            <application android:allowBackup="false" />
            <application android:fullBackupContent="false" />
</edit-config>

Then run your project. I tried this on a sample hello world project.


Then remove the lines and test again, after removing these lines the plugin works normally.

1reaction
mjessencommented, Sep 23, 2019

I have the same problem with Android 9+devices. @biswas123 did you find any solution?

Read more comments on GitHub >

github_iconTop Results From Across the Web

FL Studio Plugins Not Working | Fix Almost Any ... - YouTube
In this video we will go over common solutions for plugins that aren't operating correctly as well link resources below to set you...
Read more >
Can't get any plugins to start - TeamCity Support | JetBrains
I first tried the groovy plugin. Placed the libraries in the correct spot and placed the actual plugin zip into .BuildServer\plugins. Then I ......
Read more >
MissingPluginException while using plugin for flutter
I have put "www.google.com" just for debugging purposes. The error I get is MissingPluginException : E/flutter ( 8299): MissingPluginException( ...
Read more >
Applets and Java Web Start Applications - Oracle Help Center
If your application will not run, perform the following checks: Verify that the Java Plugin is working. Go to the http://java.com/en/download/installed.jsp.
Read more >
Plugins fail to start in Jira 8.20 with Java 11.x
Issue Summary. System plugins fail to start in Jira 8.20.2 with Java version 11.0.11+9 > 11.0.14 installed. This occurs with frequent restarts.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found