termux / termux-app

Termux - a terminal emulator application for Android OS extendible by variety of packages.
https://f-droid.org/en/packages/com.termux
Other
35.81k stars 3.77k forks source link

Toggling services like location services #1451

Open ghost opened 4 years ago

ghost commented 4 years ago

Feature description I don't know if this is possible or not, but I was hoping there was a way to toggle settings through Termux. For my use case, I would like to create a script on a cron that checks for certain criteria and enables or disables the location services on my phone. Basically an automated way of doing stuff.

Reference implementation Does another app/terminal emulator have this feature? Provide links to more background information

Probably apps like AutoApp or whatever but because they require pay or have ads, I don't really trust them to control my phone settings. :)

schoentoon commented 4 years ago

While quickly looking at the documentation regarding this, it does seem to be possible in Android R. But it would require Termux to be a device administrator (which it isn't right now) https://developer.android.com/reference/android/app/admin/DevicePolicyManager?hl=en#setLocationEnabled(android.content.ComponentName,%20boolean)

Alternatively it seems like it could be prompted for (which doesn't seem very ideal) and would depend on Google services https://developer.android.com/training/location/change-location-settings#java