• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

how to trigger a task by touch a widget toggle?

If you can toggle it with Tasker, then you can build your own widget with Tasker. If you only change the relevant settings with Tasker, then Tasker will "know" the current setting at any time based on what settings Tasker last established (tracked with variables).

I see Locale used to be able to do this but seems broken:
https://play.google.com/store/apps/details?id=com.steelgirder.LocaleGVSettingsPlugin&hl=en

Secure settings has some options related to SIP voice which might be the same thing (not sure)
 
Upvote 0
That's why I said " If you only change the relevant settings with Tasker..."

I have a large number of settings that I've turned over to Tasker and never adjust via systems settings. Works fine for me.

In the case of two state toggles (not the same as op), it allows me to leave a permanent notification whenever I enter the abnormal state which reminds me to turn back to normal. Example
  • usb debug: abnormal = enabled
  • external source: abnormal = enabled
  • brightness: normal = auto; abnormal = manual with max brightness
I also have turned over on/off control of audio streams to Tasker. I have 6 profiles and 5 of them put a number in my notification which lets me know exactly how many prioritized audio streams are disabled.
  • 0 = no streams disabled
    • for use when alone, not worried about bothering people
  • 1 = notification stream disabled.
    • reduce bothering other people
  • 2 = notification plus (virtual) high-priority notification streams disabled
    • Use this when I sleep while "on call". Keeps ringer open'
    • I built my own "high priority" notification stream in Tasker. If notification listener detects a suitable high-priority notification, it will play a custom sound on the ringer stream provided the last selected menu number was below 2.
  • 3 = all above plus ringer steam disabled
    • Use this when I sleep when not on call. nothing bothers me. Media and alarm remain available)
  • 4 = all above plus media stream disabled
    • meetings. alarm is still enabled, but I can silence it really quick with my watch
  • 5 = all above plus alarm stream disabled
    • church
  • I use the "month days" to display a number 1-5 which instantly lets me know my audio settings. Most of the time when actively using my phone it's in O which is somewhat normal, so nothing displayed in status bar.
  • I still tweak vol level up/down (but not on/off) manually when needed. I use a shortcut which shows 4 sliders in their current values where I can slide as needed. I use the hardware volume keys to tweak level up/dwon when listening to media... I know it will adjust media volume in that context.
 
Last edited:
Upvote 0
Thanks for replies. Let me clarify what I want the Tasker to do.

The voice+ call back need network connection, but we do not want to keep data service always on.
Voice+ has a widget toggle.
When voice+ is off, it display a red cross, if user touch the toggle, then voice+ is turned on, and the toggle display a green check. If touched again, then voice+ is turned off, and the toggle display a red cross again.

I want the Tasker to turn on data service when user touch voice+ toggle to turn voice+ on, and turn off data service when user touch voice+ toggle to turn voice + off.

I know the shell command the turn on/off data service: svc data enable (disable), So the only problem is how to trigger Tasker to do it.
 
Last edited:
Upvote 0
You are now indicating that you are root-ed? On systems 5.0 and newer it is required to toggle data.

As was pointed out ... you can create a Tasker widget that would do what you want. It can keep set a Global variable to keep track of weather the option is toggled or not and change it each time. Since the state of the option can not be read you would have to make sure it is properly synchronized the first time and then always go through it tot control this activity.

... Thom
 
Upvote 0
Thanks. I have made it work with following task. I don't know how to turn on/off voice+, so I used enable/disable the app.

CallBack (17)
A1: If [ %VCB ~ 0 ]
A2: Run Shell [ Command:svc data enable Use Root:On ]
A3: Run Shell [ Command pm enable hu.xilard.voiceplus Use Root:On]
A4: Variable Set [ Name:%VCB To:1 ]
A5: Set Widget Icon [ Name:CallBack Icon:content://com.android.providers.media.documents/document/image%3A27128 ]
A6: Else
A7: Run Shell [ Command:svc data disable Use Root:On ]
A8: Run Shell [ Command pm disable hu.xilard.voiceplus Use Root:On ]
A9: Variable Set [ Name:%VCB To:0 ]
A10: Set Widget Icon [ Name:CallBack Icon:content://com.android.providers.media.documents/document/image%3A27129 ]
A11: End If

You are now indicating that you are root-ed? On systems 5.0 and newer it is required to toggle data.

As was pointed out ... you can create a Tasker widget that would do what you want. It can keep set a Global variable to keep track of weather the option is toggled or not and change it each time. Since the state of the option can not be read you would have to make sure it is properly synchronized the first time and then always go through it tot control this activity.

... Thom
 
Last edited:
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones