Hi All,
I'm very new to Android. I want to write a loging fuction which
prints logs all the recent task. I have written a function
updateTaskList that can be called by any of the loging fuction to get
the recent tasks invoked by the user.
private static void updateTaskList(StringBuilder logMessage) {
ArrayList items = new ArrayList();
try {
List tasks = manager.getRecentTasks(10, 1);
int i = 1;
logMessage.append(new String(" ******** SREEKANTH
START************ \n"));
for (Iterator iterator = tasks.iterator(); iterator.hasNext
();) {
ActivityManager.RunningTaskInfo item =
(ActivityManager.RunningTaskInfo) iterator.next();
logMessage.append(new String((i) + " : " +
item.baseActivity.getPackageName() + " \n"));
}
logMessage.append(new String(" ******** SREEKANTH
END************ \n"));
} catch (DeadObjectException e) {
Log.e("HelloApp", e.getMessage());
}
catch (Exception e){
Log.e("HelloApp SREEKANTH", e.getMessage());
}
}
I have a Logger class which is a wrapper on Log class in android
framework. I have put the above updateTaskList function as part of of
this class.
For using getRecentTasks function we need to use permissions in the
AndroidManifest file, but since the loging fuction can be called by
any of the apps, we can't modify all of the applications
AndroidManifest file to get GET_TASK permissions.
Please suggest me a way how I can resolve this issue without modifying
the AndroidManifest file of already exisisting applications that use
Logger class for logging.
I want use this while loging the exceptions so that I can know all the
tasks running at the time of exceptions.
Thanks
Sreekanth
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---