Is it possible to get started through the adb shell and get an answer?

I know that you can run any exported activity from any application via adb using the following command:

 am start -n com.myapp.test/.TestActivity 

Using the "am start" command, you can also send additional data to the action (I know how to do this, this is not the question I ask here!).

However, I need to know if it is also possible to get response data sent back from the activity that was started when it ends?

+6
source share
3 answers

UPDATE You can print the results for logcat. Just start with -W , so it waits for the launch to complete

and then do logcat -d

The OP already has an understanding for the following. I misunderstood the question, keeping it just in case for someone else who lands here

To send data to action
Please refer here for specification of intent.

You can pass key value pairs.

The quote from spec -e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> can be used to pass a pair of key lines. There are other options for transmitting data of various types.

0
source

Try the following

am start -e name Arshid -n com.myapp.test/.TestActivity

Information about codes: -

 Intent i = new Intent(Mainctivity.this, TestActivity.class); i.putExtra("name", "Arshid"); 
0
source

Workaround:

1, write an apk tool that can take intent parameters , and use these parameters for startActivityForResult . when you get the result, register it or write to a file.

2, use adb to run this apk tool, using any intent parameters you want than periodically check the logcat or file to get the result.

0
source

All Articles