top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How to execute adb commands from android activity?

+3 votes
301 views
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 });
proc.waitFor();

1 Answer

+2 votes

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

startInstrumentation(new ComponentName("com.example.aatg.tc.test", "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.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, textMessage);
sendIntent.setType(HTTP.PLAIN_TEXT_TYPE); // "text/plain" MIME type
startActivity(sendIntent);

Let me know the possible solution.

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...