views:

22

answers:

1

Is there anyway to find out the start time of an application?ActivityManager provides pids etc for each application process but doesn't tell for how long process is running.

A: 

I don't know wether there's an API for this. But one approach would be to use something like:

String pid = "yourpid";    
BufferedReader reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( "ls -ld /proc/"+pid)) , 1000 );

To get the start time of your application and the just subtract that with the currenttime.

Might not be the best way, but that's what came to mind. (And I haven't tried it..)

Gl !

Cpt.Ohlund