title: Android : when to unregister the listener - onStop() or onDestroy()
body: <p>I have basic question regarding when to <code>unregisterListener</code> for sensor manager. Should it be done in <code>onStop()</code> or <code>onDestroy()</code>.</p>
  
  <p>Usecase :</p>
  
  <p>I want to record <code>accelorometer</code> on click of start button and stop when user clicks stop button. the frequency of data is every minute. So I have started a <code>timer</code>.</p>
  
  <p>But the issue is every time the <code>orientation</code> changes as per Android architecture, <code>onStop()</code> gets called. In <code>onStop()</code> I am cancelling the timer and unregistering the listener.</p>
  
  <p>SO again if I start timer/register listener in <code>onResume()</code> the frequency won't remain 1 minute and also the data gets recorded without user pressing the start button.</p>
  
  <p>Can someone help me resolve this issue.</p>
  
  <p>Thanks.</p>