biotinker / LibreTasks

An updated form of Omnidroid
Apache License 2.0
82 stars 22 forks source link

Toggle mobile data (on/off) (feature request) #206

Open toxtox opened 7 years ago

toxtox commented 7 years ago

I have found many opensource apps for Lollipop and Marshmallow that can toggle WIFI and Bluetooth BUT only one app ("BatteryFu") that is able to toggle mobile data. Obviously the only opensource app that can toggle mobile data for my CM13 Marshmallow is "BatteryFu" https://github.com/tobykurien/BatteryFu Unfortunately BatteryFu does not offer a timetable (task list) for toggling mobile data. Sure BatteryFu toggling solution needs root but this is not a big disadvantage because there is obviously no other alternative.

  1. Do you think it is possible to integrate the "toggle mobile data sourcecode" into LibreTasks?

Maybe you could ask Andy Boeh ( https://github.com/andyboeh ) or Toby Kurien https://github.com/tobykurien for helping you.

  1. An alternative could be to trigger the running BatteryFu app in order to toggle mobile data. An example for a BatteryFu-Integration is shown on here, too: https://github.com/tobykurien/BatteryFu

    `// turn data on

    Intent intent = new Intent(); intent.setAction("batteryfu.intent.action.TOGGLE"); intent.setData(Uri.parse("data://on")); sendBroadcast(intent);`

But I am not sure if you will get conflicts between the settings in BatteryFu and the trigger-signals of LibreTasks.

toxtox commented 7 years ago

Maybe toggling mobile data is easier than I thought

http://stackoverflow.com/questions/23528824/is-there-an-adb-command-to-enable-disable-mobile-datarooted-device

alternatively you an automate a terminal shortcut with the command

su -c "sh svc data enable" or _su -c "sh script_with_svc_command.sh"_

biotinker commented 7 years ago

Libretasks is not currently a root application (it may someday have the option to enable root for additional actions, but not currently).

That said, the intent to toggle mobile data shouldn't be any more difficult than wifi, I can probably work this into the next release.

toxtox commented 7 years ago

If you just run a terminal shortcut command launched by LibreTasks then LibreTasks should not need root. You need just a rooted phone and set the general root-access in settings to "only apps". This works especially for CM13 devices.

You could check this with the app "Sfen" 1.0. This opensource tasker app allows to run terminal shortcuts . https://github.com/lordgreg/Sfen

By the way, running terminal shortcuts would be a very mighty killer feature for LibreTasks or course. I have seen that someone else was already interested in such a feature #202 .