I thought I would try using ps with code like the one listed below.
headers for the process list are reported correctly but not much else.

 When you mentioned accessing /proc directly, did you have something
else (other than ps) in mind?

Thanks.

Alex Donnini

    private void getProcessList()
    {
        System.out.println("retrieving list of running processes via --
ps -e -- command");
        try
        {
            processList = new ArrayList<String>();
            String line;
            java.lang.Process p = Runtime.getRuntime().exec("ps -e");
            BufferedReader input =
                    new BufferedReader(new
InputStreamReader(p.getInputStream()));
            while ((line = input.readLine()) != null)
           {
                System.out.println("running process - "+line); //<--
Parse data here.
                processList.add(line);
            }
            input.close();
        }
         catch (Exception err)
        {
            err.printStackTrace();
        }


On Oct 26, 2:43 pm, alexdonnini <[EMAIL PROTECTED]> wrote:
> Thanks. I understand the risk in going for direct access.
>
> On Oct 24, 1:09 am, hackbod <[EMAIL PROTECTED]> wrote:
>
> > Sorry, we don't currently have a high-level API for doing this.  As a
> > hack, you can read /proc directly, but that is not something that is
> > part of the SDK and so you have no guarantees of it working on future
> > releases or other phones.
>
> > On Oct 23, 8:25 pm,alexdonnini<[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > Would anyone be able to tell me (or point me in the right direction)
> > > how I could retrieve the pids and related process information as
> > > reported, for example, in DDMS in an Android application?
>
> > > I have been able to put together a small application that retrieves
> > > information about all tasks running
> > > (ActivityManager activityManager =
> > > (ActivityManager)this.getSystemService(ACTIVITY_SERVICE);
> > >         List<ActivityManager.RunningTaskInfo> runningTasks =
> > > activityManager.getRunningTasks(30); )
>
> > > However, if possible, I would like to retrieve task and process
> > > information at a higher level of granularity (or, if you like, at
> > > lower level).
>
> > > Any help would be greatly appreciated.
>
> > > Thanks.
>
> > > Alex Donnini
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to