Do you want to gather data from multiple Android devices remotely at the same time or control the devices? Absolutely possible. Although digital markets have solutions already, I wanted to do the task bit differently with common server management tools: SaltStack.
It turned out to be possible: Android devices can successfully be controlled with SaltStack.
Table of Contents
Imagine you have dozens or hundreds Android devices which require remote management. You don't like market solutions and want to use pure Linux tools for direct & raw access instead? If yes, this article is for you.
Basically, with SaltStack, you can
run commands & control applications of multiple Android devices simultaneosly
gather statistics such as temperature or GNSS (Global Navigation Satellite System) information from multiple Android devices simultaneosly
manage Android devices simultaneosly
classify & create separate groups for Android devices
SaltStack is usually used to control multiple remote clients (minions) with a central server (master) or with multiple masters. In the most common use cases, both minions and master(s) are regular laptops, desktop computers or server computers.
Other solutions to centrally manage computers exist, too. Such as Chef, Puppet & Ansible.
There are many good articles covering SaltStack and, additionally, a compherensive SaltStack documentation.
Android and SaltStack
I came up with experimenting with SaltStack on Android due to various reasons: potential, curiosity and as a result of a simple fact that Android mobile phones/tablets are just Linux-based computers with mobile stuff added on the top.
Regardless of the most target systems of SaltStack, launching application processes and accessing system data remotely on Android is possible, as well.
For instance, launching Android app NewPipe from Salt master computer on target Android system
1# Launch NewPipe app main activity window remotely from Salt master computer 2sudo salt 'android_minion' cmd.run "am start -a android.intent.action.MAIN -n org.schabi.newpipe/.player.MainActivity" 3 4# Launch NewPipe app video player window remotely from Salt master computer 5sudo salt 'android_minion' cmd.run "am start -a android.intent.action.MAIN -n org.schabi.newpipe/.player.MainVideoPlayer" 6 7# Launch NewPipe app settings window remotely from Salt master computer 8sudo salt 'android_minion' cmd.run "am start -a android.intent.action.MAIN -n org.schabi.newpipe/.settings.SettingsActivity"
or Android tethering settings with:
1# Launch Android tethering settings remotely from Salt master computer 2sudo salt 'android_minion' cmd.run "am start -a android.intent.action.MAIN -n com.android.settings/.TetherSettings"
These commands open the requested application window on the mobile screen and start the app process on a Android phone/tablet.
As prerequisite you need
an Android system to which you can establish a SSH connection.
Custom SaltStack build is required for the Android
Obviously, network connection between minion & master computers must be available.
Rooted Android preferable, although might not be required
Other SaltStack Deployment Projects
You can find my sample SaltStack project for common Linux & Windows environments on GitHub (SaltStack - GIS workstation setup).