top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to execute adb commands from android activity?

+3 votes
How to execute adb commands from android activity?
posted Nov 8, 2013 by Deepak Dasgupta

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
you cant try with abd shell commands for ex:-
Process proc = Runtime.getRuntime().exec(new String[]{ your adb commands });

1 Answer

+2 votes

You should use Context.startInstrumentation, instead of adb. For example, from your Activity, run

startInstrumentation(new ComponentName("", "android.test.InstrumentationTestRunner"), null, null);

answer Jun 19, 2014 by Anuj Agrawal
how can i add -w flag and any other required flags while using this startInstrumentation() method.
Similar Questions
+3 votes

how can install apk through ADB in android device.

+3 votes

Hi, I have used the below sample code downloaded from a website and it is crashing.

Intent sendIntent = new Intent();
sendIntent.putExtra(Intent.EXTRA_TEXT, textMessage);
sendIntent.setType(HTTP.PLAIN_TEXT_TYPE); // "text/plain" MIME type

Let me know the possible solution.