On Mar 27, 4:07 pm, Michael MacDonald <[email protected]>
wrote:
> Environmentvariables will only be visible in processes descending from
> the process that sets them. Since the app processes in android aren't
> spawned from your daemon, you won't be able to see theenvironment
> variables there.
>
> Charles Lu wrote:
> > Hi,
>
> > I wish to get theenvironmentvariable which is set by a daemon in
> > native but failed. Some details:
> > in the daemon, which is started by root
> > setenv("MY_NAME", name, 1);
>
> > in java code, which is started by system
> > String name = System.getenv("MY_NAME);
>
> > Could anybody give some suggestion?
>
Using daemon's PID you can do
Process pr = Runtime.getRuntime().exec("cat /proc/" + pid + "/
environ");
and obtain the environment in pr.getInputStream().
> > Thanks
> > Charles
>
>
--
Have you read my blog ?
http://dtmilano.blogspot.com
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---