I need to track app usage in Android like how AppUsage does it (i.e. track number of app launches, and time spent using each). What I plan on doing is record the start time
Basically, how do I detect when an activity is launched?
You don't. There is nothing in the Android SDK for "the start time when an app is launched" nor "the end time when an app is paused or stopped".
What the app you cite is probably doing is wasting a lot of CPU time, RAM, and battery life, polling ActivityManager
continuously.
Bear in mind that what you propose to track, if you plan on having anyone other than the user access it, borders on privacy violations of the type that got CarrierIQ in a fair amount of trouble.