I want to install a diagnostic app from adb
and get back data from it from within a bash script. I know how to start an activity from adb
, but I can't find any way to get data back unless maybe if I print to logcat
and parse the output, but that sounds like a hack. Is there a way to receive data back from an activity started using adb
?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Check if directory exists on remote machine with s
- Why is the app closing suddenly without showing an
There is a little In/Out bash sample:
1st preparation:
Then you could write to
&5
and read from&6
:Nota: I
rm $tmpfile
for security reason, but while descriptors stay open, you could use them (timeout option ofread
work just fine withwhile
loop):And
When finished, close everything:
If the data that you want to send back to your automation script could be serialized into a string less than 4k long - using
logcat
is a natural choice. Just make your activity to print the data to the log withLog.i("UNIQUE_TAG", the_data_string_you_want_to_send_back_to_your_script);
and then use the following commands in your automation script to capture the output:In more recent Android versions (7.0+) where
logcat
properly supports-m <count>
,-t <time>
and-T <time>
parameters you can use this much simpler version without having to clear the log withlogcat -c
first: