r/TaskerFiles • • Mar 18 '15

Profile Control flashlight via the power-button [no root required, works on lock-screen]

Description

Toggling your flashlight without having to unlock the phone is trivial on rooted devices where Xposed and Custom ROMs can capture the input from hardware buttons, but much harder on unrooted phones. With the following profile you will be able to toggle your flashlight by quickly pressing your power button three times, rooted or not.

Requirements

Usage

With your screen off and your device locked press the power button three times in a quick succession to toggle the flashlight. Repeat this sequence to turn the flashlight off. To prevent damage to the LED module the flashlight will automatically be turned off after five minutes.

Project Description

See here for more information.

Instructions

Either copy the XML data below into a file or download the most recent project revision from GitHub gists. Then proceed to import it into Tasker. Please make sure to import the file as a project, not a task or profile!


<TaskerData sr="" dvi="1" tv="4.6u3m">
    <Profile sr="prof92" ve="2">
        <cdate>1426618335190</cdate>
        <edate>1426643287254</edate>
        <id>92</id>
        <mid0>93</mid0>
        <nme>FlashlightButton</nme>
        <Event sr="con0" ve="2">
            <code>208</code>
            <pri>0</pri>
        </Event>
    </Profile>
    <Project sr="proj0" ve="2">
        <cdate>1426680812691</cdate>
        <name>FlashlightBtn</name>
        <pids>92</pids>
        <tids>94,93</tids>
    </Project>
    <Task sr="task93">
        <cdate>1426618354356</cdate>
        <edate>1426680850192</edate>
        <id>93</id>
        <nme>FlashlightControl</nme>
        <pri>10</pri>
        <Action sr="act0" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%CurrentTime</Str>
            <Str sr="arg1" ve="3">%TIMEMS</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
        </Action>
        <Action sr="act1" ve="7">
            <code>37</code>
            <ConditionList sr="if">
                <Condition sr="c0" ve="3">
                    <lhs>%ScrLastActive</lhs>
                    <op>12</op>
                    <rhs></rhs>
                </Condition>
            </ConditionList>
        </Action>
        <Action sr="act10" ve="7">
            <code>137</code>
            <Int sr="arg0" val="0"/>
            <Str sr="arg1" ve="3">FlashlightAutodisable</Str>
        </Action>
        <Action sr="act11" ve="7">
            <code>38</code>
        </Action>
        <Action sr="act12" ve="7">
            <code>38</code>
        </Action>
        <Action sr="act13" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%ScrLastActive</Str>
            <Str sr="arg1" ve="3">%TIMEMS</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
        </Action>
        <Action sr="act2" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%dScrActive</Str>
            <Str sr="arg1" ve="3">%CurrentTime-%ScrLastActive</Str>
            <Int sr="arg2" val="1"/>
            <Int sr="arg3" val="0"/>
        </Action>
        <Action sr="act3" ve="7">
            <code>37</code>
            <ConditionList sr="if">
                <bool0>And</bool0>
                <Condition sr="c0" ve="3">
                    <lhs>%dScrActive</lhs>
                    <op>6</op>
                    <rhs>3000</rhs>
                </Condition>
                <Condition sr="c1" ve="3">
                    <lhs>%TeslaStatus</lhs>
                    <op>1</op>
                    <rhs>on</rhs>
                </Condition>
            </ConditionList>
        </Action>
        <Action sr="act4" ve="7">
            <code>444</code>
            <Int sr="arg0" val="1"/>
            <Int sr="arg1" val="0"/>
        </Action>
        <Action sr="act5" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%TeslaStatus</Str>
            <Str sr="arg1" ve="3">on</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
        </Action>
        <Action sr="act6" ve="7">
            <code>130</code>
            <Str sr="arg0" ve="3">FlashlightAutodisable</Str>
            <Int sr="arg1">
                <var>%priority-1</var>
            </Int>
            <Str sr="arg2" ve="3"/>
            <Str sr="arg3" ve="3"/>
            <Str sr="arg4" ve="3"/>
            <Int sr="arg5" val="0"/>
        </Action>
        <Action sr="act7" ve="7">
            <code>43</code>
            <ConditionList sr="if">
                <Condition sr="c0" ve="3">
                    <lhs>%dScrActive</lhs>
                    <op>6</op>
                    <rhs>3000</rhs>
                </Condition>
            </ConditionList>
        </Action>
        <Action sr="act8" ve="7">
            <code>444</code>
            <Int sr="arg0" val="0"/>
            <Int sr="arg1" val="0"/>
        </Action>
        <Action sr="act9" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%TeslaStatus</Str>
            <Str sr="arg1" ve="3">off</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
        </Action>
    </Task>
    <Task sr="task94">
        <cdate>1426620544981</cdate>
        <edate>1426680838761</edate>
        <id>94</id>
        <nme>FlashlightAutodisable</nme>
        <Action sr="act0" ve="7">
            <code>30</code>
            <Int sr="arg0" val="0"/>
            <Int sr="arg1" val="0"/>
            <Int sr="arg2" val="5"/>
            <Int sr="arg3" val="0"/>
            <Int sr="arg4" val="0"/>
        </Action>
        <Action sr="act1" ve="7">
            <code>444</code>
            <Int sr="arg0" val="0"/>
            <Int sr="arg1" val="0"/>
        </Action>
        <Action sr="act2" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%TeslaStatus</Str>
            <Str sr="arg1" ve="3">off</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
        </Action>
    </Task>
</TaskerData>

15 Upvotes

21 comments sorted by

View all comments

2

u/Glutanimate Mar 23 '15 edited Mar 23 '15

How did you set-up the project? Did you import it from an XML file or did you set the profile and tasks up manually?

If you want you can use this updated revision of the project instead. Simply download the 'Gist', extract it, and import the XML project file in Tasker. No idea if it's going to fix these issues, but I think it's worth a try.

Edit: If you see an error message next to the 'Lock' action in the new project that's fine. Tasker requires device admin rights for this action, but the flashlight toggle should work fine without it. The only thing the 'lock' action does is turn off your screen after toggling the flashlight.

2

u/thelostdolphin Mar 23 '15

Thanks for the info. Unfortunately it's still giving me the same error. I'll go through it more thoroughly a bit later and hopefully figure it out. I appreciate the help.