2

Say I was running facebook for android or something, and I wanted to delete all my friends or messages. Would I have to program a macro to do this?

B. would it be possible to send the application direct commands? Delete this friend or do this? Similarly if I was going to write something for the computer?

ale
  • 19,723
  • 34
  • 110
  • 159
user60727
  • 33
  • 2

1 Answers1

2

Not in the general case, no. It's possible to send an intent to start an activity or service (or broadcast an intent to receivers) using the am tool from the Android shell (and therefore from a PC using adb shell). What you can do that way depends on what intent filters the app's developer has chosen to offer, and in most apps it doesn't include actions like deleting individual data items.

An alternative approach is the monkeyrunner tool. This is a testing tool, and it lets you write a Python script to send input events (and the like) via adb to an app running on your device. However, because it's designed for testing your own app, it's very limited in what it can do. To send a touch event, you have to program in the exact x and y co-ordinates that you want to touch: it can't record input and play it back later, like a general macro tool.

Dan Hulme
  • 35,000
  • 17
  • 90
  • 155