Unlimited Proximity Gestures 2020-08-11

With this project you can create an infinite amount of proximity based profiles

  1. joaomgcd
    Check out the demo:


    Import the project above and setup any number of gesture profiles you want!

    The heart of this project, the part that actually detects how many gestures you performed, is in the Gesture Detector profile.

    As you can see it's based on the Any Sensor event condition and triggers with the Buffer Debounce interval type with a 1 second interval.

    The Debounce part means that the event will trigger when the sensor doesn't detect any values for more than 1 consecutive second.

    The Buffer part means that the event's output variables (namely %as_values()) will have all of the detected values while the event wasn't triggered.

    In basic terms this means that you can collect all the sensor events during a specified amount of time and then go through that data in the task and act on it.

    Here's a practical example:
    • every half a second you put your hand in front of the proximity sensor and then take it away
    • After 3 times doing this you stop
    The timeline of this be will be something like:
    • at 500 ms: hand in front of sensor
    • at 1000 ms: hand not in front of sensor
    • at 1500 ms: hand in front of sensor
    • at 2000 ms: hand not in front of sensor
    • at 2500 ms: hand in front of sensor
    • at 3000 ms: hand not in front of sensor
    • at 4000 ms Tasker event triggers because no sensor event was detected for more than 1 second
    The %as_values() variable would now contain all the values related to the full 3 seconds of gestures, so you can inspect those values in the task to find out what exactly happened during those seconds.

    This is where it gets tricky

    Sensors output arrays, and here you'll have multiple sensor outputs, so what do you get? Arrays of arrays!

    In %as_values1 you'll have the first sensor event output that was detected, in %as_values2 you'll have the second sensor event output and so on.

    In each one of those, for example in %as_values1 you'll have an array with the various values of that sensor event. As you can see in Android's documentation the only value that matters here is the first one, so in Tasker we only care about:
    • %as_values11
    • %as_values21
    • %as_values31
    • %as_values41
    and so on...
    If you check the task in Gesture Detector profile it's simply going through all of those values and checking how many times it switched from one value to another.

    Hope you learned the basics about the Buffer Debounce Interval Type in the Any Sensor condition. As you can see it can be pretty powerful!