title: How to find time spent on specific app?
body: <blockquote>
    <p>How to Get the Time spent on an specific application using <strong>packagename</strong> in Android Programmatically? </p>
  </blockquote>
  
  <p>After doing google I found this <a href="https://stackoverflow.com/q/32825854/6333971">stack overflow question</a> and <a href="https://stackoverflow.com/q/31097599/6333971">this</a> but I didn't get any proper solution. </p>
  
  <p>Does any one know how to I get that time for all android version? </p>
  
  <p>I also tried <a href="https://stackoverflow.com/q/16397784/6333971">this</a> but I don't want to do background service. <strong>When user back to my app I just want to know that does user used that app for given time or not.</strong> </p>