Jason Yu Jason Yu - 1 year ago 125
Android Question

Android: how to determine cold start

When app being launched, how to determine it is cold start or not?
By cold start, I mean the app launched from the very beginning, instead of just resumed from a previous state.

elaborate my question:
I'm trying to find the app's launch mode: cold start or warm start. Cold start means the app is never launched before or not in background, so it needs a complete launch. Warm start means it is still in background, so it can resume and start faster. How to distinguish these two start modes programmatically?

Answer Source

If the app is still running in the background it will call onResume first and not onCreate at all.

If you mean the first time it was ever launched on a device then use sqlite or shared preferences to store data and at the beginning check to see if its there.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download