Continuing topic " Bind to a remote service"

by Dianne Hackborn » Fri, 01 May 2009 01:07:10 GMT

Sponsored Links
 ust put the interface definition in both applications (and make sure the
service is exported). There is really nothing special about this beyond the
existing remote service sample code.

On Thu, Apr 30, 2009 at 7:28 AM, Rashmi GP <> wrote:

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails. All such
questions should be posted on public forums, where I and others can see and
answer them.


Other Threads

1. getRuntime().exec("su do seomthing") fails (exit code)

I work on rooted unlocked G1, latest JS firmware ADP1.5
I wrote some application that perform some root actions in the /system
of course, when messing up /system requires to remount that partition
but that's not my issue.

the code is fairly simple (attached at bottom of this message).
however when running a command as root (for example executeAsRoot("su
ls -l /system")) I get exit code 255 (i.e. -1 or failure)
when running that command as non-root - it runs ok with exit code 0.
The strange thing that this happens only in the real G1 . On the
emulator, root commands work just fine.
if i open a terminal on the G1 and perform su - I get the
"allow"/"deny" screen but after that I am able to perform actions as
How can I debug the reason for the application process failure ?

private int executeAsRoot(String command) {
                Process process = null;
                int exitVal = -1;
                try {
                        process = Runtime.getRuntime().exec(command);
                        exitVal = process.exitValue();
                        m_logsView.append("\nexecuted:"+command +" 
"success" : exitVal));
                        Log.i("executeAsRoot","Exit value is:"+exitVal);
                } catch (IOException e) {
                        m_logsView.append("\nexecuted:"+command +" 
                        Log.e("executeAsRoot",e.getLocalizedMessage(), e);
                } catch (InterruptedException e) {
                        m_logsView.append("\nexecuted:"+command +" 
                        Log.e("executeAsRoot",e.getLocalizedMessage(), e);
                } finally {
                        if (process != null) {
                return exitVal;



2. ActivityInfo is null in Intrumentation class

    public void onStart() {
_intent = new Intent(Intent.ACTION_MAIN);
_intent = _intent.setClass(getTargetContext(), ClassUnderTest.class);
ActivityInfo ai = _intent.resolveActivityInfo(getTargetContext
().getPackageManager(), 0);
        if (ai != null) {
                   ClassUnderTest activity = (ClassUnderTest)

This a part of my code in my Instrumentation class. Earlier, i got a
run time Exception,Quote:
java.lang.RuntimeException: Unable to resolve activity for: Intent
{ flags=0x10000000 comp={} }.

Later on, i checked the activity info which is always null. How to set
the ActivityInfo..? What is required to update in the code?


3. where to download android 1.5 r1 source code ?

4. how to know whether an app is installed or not

5. webView: How to click a web link and display in my WebView app

6. where to download android 1.5 r1 source code ?

7. About SQLite (query)