Termux API
Software
Access to Android device sensors and system functions for automation
"The Termux API actually gives you access to the sensor data on your phone. You can access information about the battery, change the Wi-Fi network, change the volume, take photos using the Android phone, adjust the brightness, trigger the vibration motor."