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

Bluetooth Countdown Alarm Widget with Tasker

james899

Lurker
I'm trying to do this:

When a bluetooth device connects I need a countdown timer to start for a preset time (e.g. 20 mins). The remaining time should be shown decreasing on a 1x1 widget (showing the seconds, as well as minutes remaining is preferable). When the countdown finishes I need an audible alarm with popup button to snooze or dismiss it.

If the bluetooth connection is dropped before the countdown ends, the countdown should be dismissed (until a bt connection is made again at which point it should begin a new countdown).

It would be even better if the preset time could be a random figure within a set range e.g. between 30 mins to 70 mins.

UPDATE: Here's a basic summary of how I did most of this:

Create a profile with state bluetooth connected. Then create a task (e.g. Let's call it "Bt Alarm")

For

Variable %mins Items 20:1

Set Widget Label
Name Alarm Widget Label %mins

Wait
Minutes 1

End For

Perform Task
Bt Alarm 2

You need to create a task widget on your homescreen with the name "Alarm Widget" which points to this task called "Bt Alarm". This sets up a loop which will run for 20 times, each time, reducing the variable %mins by 1, and by re-setting the label of the widget each loop, the widget label effectively becomes a countdown widget. When the countdown is up, it performs the task "Bt Alarm 2" which is:

Music Play
File:
Popup Task Buttons:
Bluetooth Snooze
Bluetooth Cancel


Bluetooth Snooze:
Music Stop
Set Widget Label Alarm Widget Label: Snooze
Wait Minutes 5
Perform Task: Bt Alarm 2

Bluetooth Cancel:
Music Stop
Stop Task: Bluetooth Snooze
Set Widget Label: Alarm Widget Label: Off.

To cancel when bluetooth disconnects before the alarm goes off:
Create a profile for bluetooth Not connected (i.e. Inverted Bluetooth connected). Then:
Stop Task: Bt Alarm 2
Stop Task: Bluetooth Snooze
Stop Task: Bt Alarm
Set Widget Label: Alarm Widget Label Off.

It might not be beautifully written but it works for me. Reply, if I haven't explained well enough.
 
It is to me. As I want to disable WiFi enable mobile data when BT connects because that means I am in my car.

I just found Tasker and its forums today and I think this functionality might just make me jump now to get my new phone versus waiting until after thanksgiving! LOL! :D
 
Back
Top Bottom