title: Stop fetching GPS location if application goes in background in ANDROID
body: <p>I am currently working on a task where i need to fetch the locations from GPS.
  The concern i am having here is that once i obtain the location &amp; the task goes completed, after this if the application goes in background i do not wish to obtain any locations until &amp; unless my application is back on screen (foreground) whatis currently not happening. (kindly note here i am not talking about switching the activity from one to another via intent as my app has only one screen &amp; one activity).</p>
  
  <p>I wish to know what place exactly the code to handle this situation must go &amp; how can i do achieve this. I have tried with setting the instance to null &amp; remove update but it proves ineffective. May be i am putting it at wrong place i am putiing it outside <code>onCreate()</code> inside the class extending activity.</p>