title: cordova background geolocation plugin on reboot
body: <p>I am building an ionic app with background geolocation plugin <code>https://github.com/mauron85/cordova-plugin-background-geolocation</code>.</p>
  
  <p>I want to make an app to send its location after reboot. The plugin I am using seems to have the option, but it is not working properly. An app only sends its location to the server only after execute an app at least once after every boot.</p>
  
  <p>Any help or suggestion would be appreciated. Thank you in advance!</p>
  
  <p>My code is below</p>
  
  <p><strong>Configuration</strong></p>
  
  <pre><code>backgroundGeolocation.configure(callbackFn, failureFn, {
              locationProvider: backgroundGeolocation.provider.ANDROID_ACTIVITY_PROVIDER,
              desiredAccuracy: 10,
              stationaryRadius: 10,
              distanceFilter: 10,
              interval: 60000,
              maxLocations: 50,
              startOnBoot: true, // from my understanding, this should make an app track its location even after reboot
              stopOnTerminate: false
  });
  </code></pre>
  
  <p><strong>Callback Function</strong></p>
  
  <pre><code>var callbackFn = function(location) {
          console.log('[js] BackgroundGeolocation callback:  ' + location.latitude + ',' + location.longitude);
  
          // Do your HTTP request here to POST location to your server.
          var link = API_URL;
  
          $http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded";
  
          $http({
              method: 'POST',
              url: link,
              headers: {'Content-Type': 'application/x-www-form-urlencoded'},
              transformRequest: function(obj) {
                  var str = [];
                  for(var p in obj)
                  str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
                  return str.join("&amp;");
              },
              params: {
                  'device': 'android',
              },
              data: {
                  lat:location.latitude,
                  lng:location.longitude,
              }
          }).success(function(data){
              console.log(data);
          }).error(function(data){
              console.log(data);
          });
  
          backgroundGeolocation.finish();
      };
  </code></pre>