I am trying to find the last activity time of a running service on an android device.I have tried the following.
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE))
{
if (service.service.getClassName().contains("com.truecaller"))//for example
{
System.out.println(service.service.getClassName());
System.out.println(service.lastActivityTime);
System.out.println(service.activeSince);
}
}
I put a tag for system.out on logcat.i executed the program twice with a gap of a minute between the executions.But the output was exactly the same for both.how is that possible.how do we find the actual last activity time of a service?any help would be much appreciated.