yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] DVDeus:
Hi.

Nice tool, thanks. I am using it with Tasker when I open selected apps (browser, email,...). One thing I cannot solve is how to disable mobile data, when I quit this selected app? Before Lollipop, Tasker automatically changed the setting (mobile data) to the state that was before the change. On android 5.0+, I cannot achieve this. Therefore when I close the app, mobile data stays enabled. I also tried with running script (svc data enable/disable), but the result is the same.

I guess this is more a Tasker question, but maybe someone knows a trick or two:)

Thanks!
[Android Apps and Games] cygery:
There were changes in Android 5.0 which make it impossible to monitor which app is in foreground as before.
[Android Apps and Games] biogon:
Hi Cygery,

Didn't read through all the posts, but it works great on Moto G (2015/3rd gen) XT1540 with 5.1.1.

The XT1072 you have listed is actually a G LTE (2014/2nd gen).

Also, many thanks for the app and for making it available on xda! :)

My Moto G is my preferred personal phone on a limited plan (I have a work-issued phone with unlimited data, but I only use it for work purposes) and I like to micromanage my mobile data usage. :).
[Android Apps and Games] IronTechmonkey:
It should be possible in Tasker to have some condition invoke the enabling or disabling of mobile data using the Toggle Data 5.0 plug-in in Tasker. I just tested the raw functionality of Toggle Data 5.0 as invoked by Tasker it worked fine (a chorus of angels sings, as does my appreciation!). Tasker conditions usually restore whatever toggle they invoke which is what you want, but as the device is used, states and settings are changed by other things and cause Tasker to forget, or more accurately, defer to another app that had more recent control over that action. In my experience the per application conditions don't work as reliably in this regard as other Tasker conditions. As result of this, and since I usually had to wait a few seconds for data connections to be established, I use easily and redundantly accessible manual toggles instead of conditions for this purpose (Nova Launcher swipe actions, LMT Pie, home-grown toggle dashboard created with tasker).

One additional, and perhaps significant note here in regards to the root access problems sone folks have experienced... When I tested Toggle Data 5.0 in CM12.1/L5.1.1 while using native CM privacy guard to manage root access Toggle Data 5.0 did not work and suggested I did not have root access. Having seen issues with CM's native SU access in the past and knowing The Awesome Power of a Fully Operational Mothership, I mean fully operational Super SU, I installed SU on teh same ROM and voila - Data Toggle 5.0 works.
[Android Apps and Games] IronTechmonkey:
[MENTION=5253144]cygery[/MENTION], I'm curious about something. Why does Data Toggle 5.0 ask for SU permissions during changes in the state of WiFi connection and other times while mobile data stays disabled? [EDIT] ...and why requesting permissions when I turn on screen (with Wifi and Mobile data off)?
[Android Apps and Games] DVDeus:
[MENTION=5119654]IronTechmonkey[/MENTION]: I was thinking the same regarding remembering the previous state.. Anyway, I will play around some more time, maybe even discover something;)
[Android Apps and Games] ondrejvaroscak:
Version 1.5.2.0 works wonder with Tasker and 5.1.1 Lollipop on Sony Xperia Z3 D6603.
[Android Apps and Games] cygery:
-> OP, app does periodic updates while device is in use + when connectivity changes
[Android Apps and Games] IronTechmonkey:
Thanks. I read that information. I understand why it would check during connectivity changes and why it might check when there is a widget or shortcut on the home screen but I am still curious about what is invoking the check when the screen goes on in the absence of those other factors. I would like to know the reason for that and what is the trigger to check at that moment. Of course this question might approach proprietary information that is part of how you got this to work but nonetheless, an answer to this question would be required by anyone who is security conscious before committing to use the app. You've done magic here, as even Secure Settings and Tasker have not figured this one out,... or is there some good reason that don't do it this way? The reasons for opening up permissions holes at that unlikely point where permissions do not seem required for functionality do need to be explained.
[Android Apps and Games] cygery:
Either a connectivity change broadcast is sent by Android when you switch on the screen or one of the periodic checks is triggered for the widget although there aren't any added to the home screen. I suspect the latter case. This could be optimized with additional checks/settings but isn't planned at this time.

On previous Android versions it was possible (but not intended) that third-party apps change the relevant system settings without root. Since that's impossible now, root is required.

Also, please note that it doesn't really matter if you grant an app root access ones or multiple times if it has any malicious intents.
[Android Apps and Games] cedip:
Dual Sim Phones

I just tried your app on a BQ Aquaris M5 and the widget doesn't work. The active SIM for mobile data in my case SIM2, mobile data does not get disabled when I use the widget.

From what I can see it does it correctly for SIM1 but that is not the active one for mobile data connections.

Is there a fix for that?
[Android Apps and Games] cygery:
No, this app has no specific dual SIM support.
[Android Apps and Games] cedip:
Would it be difficult to implement to toggle both mobile data connection if 2 SIM cards are present?
[Android Apps and Games] cygery:
I'm not aware of a way to do it.
[Android Apps and Games] BobbyHenceMcGee:
Thanks guy! Working great here on my Oneplus One & Two.

Was initially trying to get Tasker to execute a simple terminal command (su -c svc data disable) but Tasker doesn't have native support for terminal commands as far as I'm aware, not without doing an annoying workaround. Stumbled across this and saved me some time. Thanks again :)

---------- Post added at 12:03 PM ---------- Previous post was at 11:58 AM ----------

Check out this link and read the available commands in a terminal emulator.

You could make a script and get Tasker to run the script. Providing of course simply using this app DOESN'T already toggle both at once.. Fairly certain the terminal command "SU -c svc data enable" would work to enable it, or disable to disable both. Might be specific commands to work with only one sim, but I wouldn't really know.. I only use a single SIM and it's always in my Oneplus One. My Two is always running simless :)

Check out this page for instructions on how to do a very basic script for Tasker.

http://tasker.wikidot.com/rootbasic
[Android Apps and Games] IronTechmonkey:
I have no illusions about root access and relative safety of one or more multiple request vis a vis malware, nor to I think this is malware but I do like to know why a thing happens:). Thanks again for the information! In the end, it was requesting root every few minutes with none of those logical triggers occurring and even from a resource usage point of view I had to abandon it. If the android universe allows for it to run as a shortcut without the widget that would be great.
[Android Apps and Games] Tarcis:
Any chance we can get this on the new released 6.0 M?

Thanks!
[Android Apps and Games] cygery:
Do you have some numbers regarding the resource usage? From my experience it was negligible even considering the frequent root requests.

An option to disable automatic refreshing likely will be added in the next version, release date unknown yet, though.
[Android Apps and Games] cygery:
Yes, asap.
[Android Apps and Games] Tarcis:
cooooooool man! THANK YOU

Congrats on the great project btw
[Android Apps and Games] IronTechmonkey:
The resource usage is not really high when measured by use of processor but under use I feel the small lags that occur when the SU requests are made. I could turn off toast messages to alleviate this, but since I am in a perpetual state of ROM testing, clean flashing latest nightly once a week, I don't disable toast messages since they inform. Kind of my own issue in regards to usage scenario.

---------- Post added at 03:08 PM ---------- Previous post was at 02:59 PM ----------

This is working like a charm in a tasker task that contains variables, step jumps, and stops to track state of mobile data connection and trigger the appropriate enable or disable action accordingly, and subsequently reveals how easy it should be for CM (or most rooted ROMs?) to handle this. Hesitant to discuss further in this thread unless OK with [MENTION=5253144]cygery[/MENTION].
[Android Apps and Games] cygery:
You can feel free to discuss that here. I hope that one day Google will implement runtime permissions for (single) secure settings, like "allow app X to change setting Y" and such workarounds become superfluous.
[Android Apps and Games] cygery:
I've uploaded a new version (v1.5.3.0) which adds support for Android 6.0 and some small fixes and improvements.
[Android Apps and Games] cygery:
I've uploaded a new version (v1.5.4.0) which adds an option to control automatic refresh of the toggle state.
[Android Apps and Games] IronTechmonkey:
Looks good here on Moto E/3G w/CM12.1 recent official nightly. Nice to have that new "refresh state" option. The widget design options (which I had not explored before) are also nice. As (B)oogle forces us towards data on all the time and minimal access to our own storage locations I'm using Tasker for so many workarounds already that I may continue to use the mobile data commands described earlier, but for anyone not so heavily invested in Tasker this is still the only working mobile data toggle. Grazie mille.
[Android Apps and Games] nunoovidigal:
Hey! I have a OnePlus 2 and Toggle Data is not working ! I had OnePlus One and it worked like a charm ... I am running oxygen OS and dual SIM but I don't think that's the problem (cause the data usage is set to a specific SIM card). Can anyone help me? [MENTION=5253144]cygery[/MENTION]
[Android Apps and Games] cygery:
Error message? Got SuperSU? I've no experience with that OS and probably can't help if there's an OS-specific issue.
[Android Apps and Games] nunoovidigal:
There is no error message! Actually, toggle data is being authorized by SuperSU many many many many times per minute!

Watch 20 sec video in zip file.
[Android Apps and Games] cygery:
Thanks for the video. I could imagine that this is caused by the dual SIM. Did you try to swap your SIM cards (and update the data usage accordingly)?
[Android Apps and Games] IronTechmonkey:
Considering that the majority of available non-stock ROMS are base on CM I was curious about the OxygenOS and found this:

https://www.quora.com/How-different-are-the-Cyanogen-OS-the-Oxygen-OS-and-Android-OS-from-each-other

and this

http://www.techtimes.com/articles/5...android-5-1-based-oxygenos-with-oneplus-2.htm

which indicates that OxygenOS was born of a propriety fight over the presence of CM as default ROM on device so in this case it is possible that OxygenOS is "stock" and may have some limitations that custom ROM do not. The article also says that it is much like AOSP stock. ... for what that all was worth. Sorry for OT. Couldn't resist.
[Android Apps and Games] twe90kid:
thanks for this. testing now
[Android Apps and Games] Erik1805:
Works great. Thanks. Running on a galaxy s6
[Android Apps and Games] kual:
Just updated Nexus 5 to Android 6.0 and mobile data toogle does not work. Says "Error -4". Device is rooted.
[Android Apps and Games] Erik1805:
Using it with Tasker. Works very nice. Thanks
[Android Apps and Games] Eugenii09:
App ver 1.5.4.0

Device Samsung S5 mini duos (sm-g800h)

Android 5.1.1 ROM build LMY47X.G800HXXU1BOI2 (SER region)

SuperSU Free v2.50

Hi! I use your app as a Tasker plugin. The app toggle mobile data switcher in the notification bar succesfully, but it has no effect at the session state. It doesn't shutdown current session or establish new one.

At screens below you can see that your app succesfully toggle switcher in the bar, but the Edge session is still working.
[Android Apps and Games] cygery:
Thanks for the detailed report.

Can you try to swap your two SIM cards? This app has no support for multiple SIM cards at this time and in your case most likely only toggles mobile data for the first one.
[Android Apps and Games] Eugenii09:
From the first shot! :) If I use mobile data from the first sim, it is working as intended.

It would be great, if you can make this app to work with the second sim too!
[Android Apps and Games] cygery:
I'll look into this some time in future. Might be possible for Android 5.1 and later but not on earlier versions.
[Android Apps and Games] jyra21:
Thanks a lot, it's working perfectly on my Z3c and Tasker.
[Android Apps and Games] Sikac101:
[APP][2.2+][ROOT] Toggle Data 5.0 (xda-exclusive free version)

Your app works great for me on my S5. I use it with Tasker, no problem experienced so far. Many thanks.:good::good:
[Android Apps and Games] Superorb:
I'm trying to use this app with Llama to toggle mobile data on/off, but I can only find options to toggle the mode from 2g to 3g, etc. No toggle for on/off. LP killed my data toggle so I'm trying to find a workaround.
[Android Apps and Games] Gyr49:
Works on Nexus 7 Mobile 2013 running 6.0
[Android Apps and Games] jpascalz:
Hi Sir,

App doesn't work for me. :(

Device : LG G3

ROM : Cyanogen MOD

ROM version : 12.1-20151016-NIGHTLY
[Android Apps and Games] cygery:
Try SuperSU.
[Android Apps and Games] cygery:
Did you find the "plugin" or similar section in Llama? There you should be able to configure the Locale/Tasker plugin of this app.
[Android Apps and Games] Danusyakti:
working perfectly xiaomi mi4i with all cm based rom :good::good::good:
[Android Apps and Games] Superorb:
Yes, I was able to setup a locale action using this plugin. But there is no option to toggle data on/off, only an option to set CDMA,GSM,LTE,WCDMA, etc. I just need a way to turn data on/off. That's all.
[Android Apps and Games] jpascalz:
It works ! Thank you for your help. :)
[Android Apps and Games] xene97:
Works on the Nexus 5x! Thanks so much!
[Android Apps and Games] cygery:
Did you install my other app instead of this one?
[Android Apps and Games] Superorb:
Ha! I don't know where I got your other app from, but yes, I did install the network type app. Installed the correct one and it seems to be working with Llama as a locale plugin. Thanks a ton!
[Android Apps and Games] Fzone:
Very good

"Toggle data" is back on Lollipop! :good:

Tried with OnePlus One, version com.cygery.toggledata.xda-1.5.4.0 with COS12.1 YOG4PAS2QL.

Thank you :victory:
[Android Apps and Games] sajaman:
I also use Llama and toggling works fine (I use it to switch off mobile data when WiFi is on and vice versa) BUT when I look at the supersu log, it seems that 'toggle data' starts every minute although I am always connected with WiFi (Llama log file tells me that 'toggle data' is started only once, when I switched WiFi ). Why?
[Android Apps and Games] pyler:
Do you support sim 2 too?
[Android Apps and Games] cygery:
Not at this time but it's a planned feature (for Android 5.1 and later only, though).
[Android Apps and Games] jazzh:
It says unknown mode in cataclysm 6.
[Android Apps and Games] jazzh:
I have seen nothing in op. Nexus 5, android mm, cataclysm 6,rooted.
[Android Apps and Games] jazzh:
I'm sorry, I just saw that the thread is wrong... :(
[Android Apps and Games] ironm:
Hi

The widget design does not change anymore (on neither option). And also it tell the status very often...even with refresh state off... Have ani ideea why?

There was no problem until yesterday...

Running OPO and lastest version.

Thanks.

// problem solved. One was from supersu one...unknown...apparently now there are 2 widgets options, one e

With my custom image one without...

Thanks anyway. Super App!!!
[Android Apps and Games] thomstrack:
Other amazing app! Thanks!

And also works perfectly in Moto X 2014 (XT1097)
[Android Apps and Games] itm:
Not working on LG G4

I was really pleased to find this, as I want to turn off Mobile Data from Tasker on my LG G4. I downloaded and installed v1.5.4.0, and got Tasker to use the plug-in to disable Mobile Data, but it doesn't work. The Task executes but Mobile Data stays enabled. I'm running Android 5.1 (rooted).

Any ideas??

Edit: The widget works to toggle Mobile Data on/off, it's just the Tasker plugin that doesn't (either to toggle or to turn Data off)
[Android Apps and Games] cygery:
Did you enable support for external tools ("external access") in this app's settings?
[Android Apps and Games] itm:
Yes I did
[Android Apps and Games] cygery:
Sounds like an issue with your Tasker configuration/condition/task/etc. Make sure the task/action fires and you selected and configured the right plugin correctly.
[Android Apps and Games] itm:
It doesn't turn Data off even when I run the Task manually. I get green lights next to both actions after I execute the Task, so it looks as though they have run.

I believe that the action is configured correctly - I selected the Toggle Data 5.0 plugin, tapped on Configuration, then selected "Switch off". I also tried "Toggle" but that didn't work either.

The Task appears in the list as:

"Toggle Data 5.0

Configuration switch off"

??
[Android Apps and Games] cygery:
OK, any messages shown? Can you check your superuser logs if the app executed anything using su? If possible, please enable full content logging and post such content after trying to toggle again using the Tasker task.
[Android Apps and Games] itm:
The SU logs show multiple entries for Toggle Mobile Data. For example, I triggered it from my Tasker task at 17:57 and the SU log shows 6 entries for Toggle Mobile Data at 17:57, and more than 30 additional entries for it in the next 2 minutes. In fact it's still generating log entries for it as I type.

I don't seem to have an option for full content logging in SuperSU - is that a Pro option?
[Android Apps and Games] erriperry:
Full content logs is a pro feature but you can enabe pro for free in SuperSU settings.

Sent from my GT-S5360
[Android Apps and Games] itm:
The upgrade to Pro takes me to a £2.99 paid version. Am I using the wrong version of SuperSU?

(and SuperSU is still generating log entries for Toggle Mobile 2 hours later)???
[Android Apps and Games] kbbeer:
+1 works well. Thanks
[Android Apps and Games] cygery:
I don't know if the option to enable pro features for free still exists. Regarding the frequent su requests see OP.
[Android Apps and Games] itm:
What I don't understand is why 5 su requests are being made every 10 or so minutes - is this app permanently active?

Without the extended SuperSU logging is there any other way of diagnosing why this isn't disabling Mobile Data on the G4?
[Android Apps and Games] cygery:
You could check if Tasker provides any logs. Did you try to uninstall this app and Tasker and then reinstall them? I had occasional issues with Tasker after a system upgrade which vanished after a clean reinstall.
[Android Apps and Games] itm:
OK so I uninstalled Toggle Data, uninstalled Tasker, then reinstalled them both (Toggle Data first). Same problem.

The good news is that I've found an alternative solution - running "svc data enable/disable" in a shell script from Tasker (with root option enabled) seems to work.

Thanks for all your help anyway.
[Android Apps and Games] miznor:
Running Cyanpop 6.0 201511117 nightly through Motorola Moto G 2015 LTE (titan).

Rooted device, Toggle Data root access granted w/o error.

Any clue?
[Android Apps and Games] peret2000:
Works fine on galaxy s4 Lollipop.

I have linked Llama with the widget, because in lollipop the ability to switch has been lost.

Thanks a lot.
[Android Apps and Games] elsquare:
Sorry if a basic/llama related/OT question but couldn't figure out: how did you "link" llama to the widget, I.e. how to tell llama to turn on/off data using toggle data?

Phone is s4 w/ cm12.1 and widget itself works, root permissions set, also in widget config option to allow other apps to use it to toggle is set.

A hint or link to how to do this would be much appreciated :)
[Android Apps and Games] peret2000:
Very simple. I have it in spanish, so I am trying to figure out english options:

Create an event, an add this kind of action: 'execute (or run) a shortcut (or direct access) to an application' (do not confuse with 'execute/run an application'. Then, choose 'Toggle Data 5.0' as application, and then you can select among 'switch on', 'switch off' or 'Toggle'.

Remember, you must be root.

Regards
[Android Apps and Games] copeppe:
Doesn't work on my Zopo Speed 7 Lollipop 5.1

Of course I have rooted my device and Toggle data has SuperUser Privileges
[Android Apps and Games] copeppe:
I press toggle button but no has effect on data connection
[Android Apps and Games] capdcanoa:
does it work in android 6.0? Thank you indeed.
[Android Apps and Games] DnsFR:
GT-i9000

Hello,

Works fine in SAMSUNG GALAXY S (GT-I9000) Omni 5.1-20150416.

Did you plan to open your code in GitHub?

I'm interested to code on Android...:D
[Android Apps and Games] cygery:
Not planned at this time.
[Android Apps and Games] papampi:
Doesn't work on Moto X Style 1572 Marshmallow, default rom 6.0 ,

rooted, Supersu pro 2.52

app version 1.5.4.0

also I tried in terminal to switch data on/off with svc and no luck

~$su svc data disable
tmp-mksh: data: not found
~$ svc data disable
killed

any idea how to fix it ?

Edit:

found the problem its the enforcing problem

in tasker when i run this in shell

setenforce permissive;
svc data enable;
setenforce enforcing

(or disable)

every thing ok with root, dont know how to give permissive access to data toggle from supersu.
[Android Apps and Games] mnhs1010:
Does not work on oneplus 2 oxygen Os 5.1.1 ,not support network modes error from tasker.
[Android Apps and Games] Scolaro:
Works well for the Galaxy Note 4 on the Alliance ROM 2.2, thank you!

Finally my Tasker tasks are reliable again. :good::D
[Android Apps and Games] Dreth363:
Confirmed working on Samsung Galaxy Prime Core SM-G360T1 Android 5.1.1
[Android Apps and Games] pwag:
Toggle Data 5.0 not working for me on my S4 (Sprint) running Cyanogen 12.1

I'm getting an error:1

Privacy Guard (Super user) has Toggle Data 5.0 set as allowed. It's really frustrating because I've done everything I know to do.

Any ideas for fixing this?

***edit***

So I've left my original question intact for the next primitive screwhead who comes along with the issue. CM12 integrates Some sort of Superuser into the OS. You need SuperSU (by Chainfire) from the Google Play. Install it, updates it's binaries and set it to disregard CM12's SU (in the settings) Then Toggle 5.0 will work right.
[Android Apps and Games] mvez73:
SuperSU log is full of toggle data. Is it normal? Sorry for my bad english i speak french
[Android Apps and Games] Den2006:
Than you for your hard work in this!
[Android Apps and Games] Abhinav_Rakesh:
Working great .. I use it with my pebble tasker .. Oneplus One .. Stock CM12.1 rooted ..

sent from Bacon (OnePlus One)

---------- Post added at 03:39 AM ---------- Previous post was at 03:39 AM ----------

Is it possible it doesn't show us ... Root permission granted dialogue every now and then ?

sent from Bacon (OnePlus One)
[Android Apps and Games] cygery:
You might be able to disable the messages in your root management app.
[Android Apps and Games] mvez73:
several times a day i see message from supersu for mobile data 5.0 and the log is totally flood too. i can't post image so this is a partial link to the image. Just replace the ** by tt

h**p://img11.hostingpics.net/pics/203172Screenshot20151210212056.png
[Android Apps and Games] mvez73:
I should take my time when i read instruction... Thank you very much.
[Android Apps and Games] yzdadev:
Working on Samsung Note 4 version N910F with CyanogenMod 12.1