title: Get location in Ionic/Cordova app when in background
body: <p>Is it possible to run a background service if I close my Ionic/Cordova app (both for iOS and Android) ?  </p>
  
  <p>For the purpose I picked that pluging <a href="https://github.com/katzer/cordova-plugin-background-mode">https://github.com/katzer/cordova-plugin-background-mode</a></p>
  
  <p>So far I have that code:</p>
  
  <pre><code>$ionicPlatform.ready(function () {
              cordova.plugins.backgroundMode.isEnabled();
  
              cordova.plugins.backgroundMode.configure({
                  silent: true
              }) 
                ............
              ///do some task
  )}
  </code></pre>
  
  <p>It works fine if the app goes to the foreground but as soon as I close the  application the task I am running stops as well. 
  So is there any workaround/way to make my task running even if the app is closed ? </p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I have also added permissions for both iOS and Andorid but I am getting the same result. </p>
  
  <p><strong>EDIT 2:</strong> </p>
  
  <p>What am I trying to do in background is to write my own implementation of significant location-change service since there is no free plugin for Cordova or PhoneGap that can work with both iOS and Android.</p>