Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we check the recent launch time of an app in Android?

Tags:

android

I want to know the Recent launch time of an application in android?

like image 681
raj Avatar asked Dec 21 '25 07:12

raj


1 Answers

You can Log the System time in the onCreate of the Main Activity of the application. This time can be then set in a class level field and accessed from elsewhere in the application. You could also have similar variable for onResume(..) etc

public class MainActivity extends Activity { 
    long launchTime;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        launchTime = System.currentTimeMillis();
        ....
    }
}
like image 173
Rajdeep Dua Avatar answered Dec 22 '25 21:12

Rajdeep Dua



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!