title: Constantly running service while in app
body: <p>I am developing an app that pushes user's geolocation to the server <em>(with regards to permissions, of course)</em>.<br>Currently, when the user navigates to the account page, a method is invoked to push their geolocation to the server.<br>Instead, I would like a service <em>(if that's the best method)</em> to run while the app is running that will push the geolocation. This means that the location held for the user will always be up to date and not just updated when the account page is visited.</p>
  
  <p>There is a <code>checkbox</code> on the account page where they select if they want to share their geolocation or not.<br>I have a <code>$watch</code>er on the checkbox...</p>
  
  <pre><code>$scope.$watch("account.shareLocation", function(newValue, oldValue) {
      if (newValue) {
          locationService.pushLocation(userPosition);
      } else {
          locationService.pushLocation(null);
      }
  });
  </code></pre>
  
  <p>So, if the user selects to share their location <em>(<code>newValue === true</code>)</em> then, <code>pushLocation()</code> should be constantly invoked with the <code>userPosition</code> until the value of  <code>account.shareLocation</code> <em>(the checkbox)</em> is altered otherwise.</p>