[Android Apps and Games] Beakhole:
Disclaimer: This is my first time sharing a Tasker profile so I may not have exported the XML code properly from Tasker. So let me know if it works or doesn't work for you! I'm not an expert on Tasker or Android by any means, let alone a developer, so if you start getting weird errors when executing the profile, I'll see what I can do, but I won't make any promises. Even though you'd be hard pressed to mess anything up, I won't be held responsible for anything that you do to your phone, so proceed with caution.

If you're like me, you don't like ads on your phone. That's why I use Adaway to block ad servers by modifying the /system/etc/hosts file. From my understanding, how Adaway works is by downloading text files from a few default sources, or adding your own sources, compiling them into one text file, and then replacing your default /system/etc/hosts file with the one that Adaway just generated. (Side note: not all phones' hosts files are located at /system/etc/hosts. On some phones it's located in a different location. Adaway lets you choose what your "Target Hosts File" is in the Preferences. On both my previous phone [Verizon Galaxy S4] and my current phone [Nexus 6] the hosts file is located in /system/etc/hosts).

Anyway, if you've ever used Adaway, you know that in order to block all the latest ad servers, you have to update the hosts file whenever Adaway tells you there are updates to your hosts sources. You also know that in order for that newly-generated hosts file to take effect right away, you have to clear your DNS cache by rebooting your phone. At least, that's what they say in Adaway. I found a while ago a shell command that clears your DNS cache programatically, similar to Windows' "ipconfig /flushdns". Now, I say all of this because I hated having to reboot every time I updated the Adaway hosts file. So I created a Tasker profile that does it for me. You'll need to go buy Notification Watch for Tasker, which will monitor your Adaway notifications as the context while it's applying the new hosts file. Right when the notification says, "Applying hosts file," that's when the task begins to execute. You'll also need to get Secure Settings if you want to be able to execute the command and receive command output toast notifications afterwards. That's how I like it and I already had Secure Settings, so it worked out perfectly.

[MENTION=1571690]yochananmarqo[/MENTION] brought up a good point to me that I forgot to mention: After you import the Tasker profile, you'll need to go into the task configuration for the Notification Watch for Tasker plugin action and have it prompt you to grant it Notification Access. Alternatively, you can just go into your notifications settings and grant it Notification Access straight-away.

Below is the XML code for the Clear DNS Cache Tasker profile for Lollipop.

<TaskerData sr="" dvi="1" tv="4.7u3m">
<Profile sr="prof104" ve="2">
<cdate>1433614485961</cdate>
<clp>true</clp>
<edate>1441845938993</edate>
<id>104</id>
<mid0>101</mid0>
<nme>Clear DNS Cache</nme>
<Event sr="con0" ve="2">
<code>25022</code>
<pri>0</pri>
<Bundle sr="arg0">
<Vals sr="val">
<com.twofortyfouram.locale.intent.extra.BLURB>from "AdAway"
with "AdAway: Applying…" in title.with "Applying hosts file" in text.with "AdAway: Applying…" in ticker.

Variables list:
%nw_pkgName	Package name
%nw_tag	Tag
%nw_id	Id
%nw_title	Title
%nw_text	Text
%nw_ticker	Ticker
%nw_line_1	The 1st string
%nw_line_2	The 2nd string
%nw_line_X	…</com.twofortyfouram.locale.intent.extra.BLURB>
<com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
<net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
<net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
<net.zalio.android.tasker.notification.FILFER_MODE>normal_mode</net.zalio.android.tasker.notification.FILFER_MODE>
<net.zalio.android.tasker.notification.FILFER_MODE-type>java.lang.String</net.zalio.android.tasker.notification.FILFER_MODE-type>
<net.zalio.android.tasker.notification.PACKAGE_NAME>org.adaway</net.zalio.android.tasker.notification.PACKAGE_NAME>
<net.zalio.android.tasker.notification.PACKAGE_NAME-type>java.lang.String</net.zalio.android.tasker.notification.PACKAGE_NAME-type>
<net.zalio.android.tasker.notification.TEXT_CONTAINS_TEXT>Applying hosts file</net.zalio.android.tasker.notification.TEXT_CONTAINS_TEXT>
<net.zalio.android.tasker.notification.TEXT_CONTAINS_TEXT-type>java.lang.String</net.zalio.android.tasker.notification.TEXT_CONTAINS_TEXT-type>
<net.zalio.android.tasker.notification.TICKER_CONTAINS_TEXT>AdAway: Applying…</net.zalio.android.tasker.notification.TICKER_CONTAINS_TEXT>
<net.zalio.android.tasker.notification.TICKER_CONTAINS_TEXT-type>java.lang.String</net.zalio.android.tasker.notification.TICKER_CONTAINS_TEXT-type>
<net.zalio.android.tasker.notification.TITLE_CONTAINS_TEXT>AdAway: Applying…</net.zalio.android.tasker.notification.TITLE_CONTAINS_TEXT>
<net.zalio.android.tasker.notification.TITLE_CONTAINS_TEXT-type>java.lang.String</net.zalio.android.tasker.notification.TITLE_CONTAINS_TEXT-type>
<net.zalio.android.tasker.notification.WATCH_REMOVAL>false</net.zalio.android.tasker.notification.WATCH_REMOVAL>
<net.zalio.android.tasker.notification.WATCH_REMOVAL-type>java.lang.Boolean</net.zalio.android.tasker.notification.WATCH_REMOVAL-type>
</Vals>
</Bundle>
<Str sr="arg1" ve="3">net.zalio.android.tasker.notification</Str>
<Str sr="arg2" ve="3">Notification Watch</Str>
</Event>
</Profile>
<Task sr="task101">
<cdate>1433575256216</cdate>
<edate>1441845938993</edate>
<id>101</id>
<nme>Clear DNS Cache</nme>
<pri>100</pri>
<Kid sr="Kid">
<launchID>101</launchID>
<pkg>com.misterpyrrhuloxia.clearcache</pkg>
<vnme>1.0</vnme>
<vnum>2</vnum>
</Kid>
<Action sr="act0" ve="7">
<code>549</code>
<Str sr="arg0" ve="3">%STD_OUT</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act1" ve="7">
<code>30</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="15"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act10" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">Output: %STD_OUT</Str>
<Int sr="arg1" val="1"/>
</Action>
<Action sr="act11" ve="7">
<code>38</code>
</Action>
<Action sr="act2" ve="7">
<code>11820</code>
<Bundle sr="arg0">
<Vals sr="val">
<com.intangibleobject.securesettings.plugin.extra.BLURB>Clear DNS Cache (Root)</com.intangibleobject.securesettings.plugin.extra.BLURB>
<com.intangibleobject.securesettings.plugin.extra.BLURB-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.BLURB-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_OUTPUT>false</com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_OUTPUT>
<com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_OUTPUT-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_OUTPUT-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_TOAST>false</com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_TOAST>
<com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_TOAST-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_TOAST-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_NAME>Clear DNS Cache</com.intangibleobject.securesettings.plugin.extra.CMD_NAME>
<com.intangibleobject.securesettings.plugin.extra.CMD_NAME-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.CMD_NAME-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_REPLACE_VARS>false</com.intangibleobject.securesettings.plugin.extra.CMD_REPLACE_VARS>
<com.intangibleobject.securesettings.plugin.extra.CMD_REPLACE_VARS-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.CMD_REPLACE_VARS-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_STDOUT>%STD_OUT</com.intangibleobject.securesettings.plugin.extra.CMD_STDOUT>
<com.intangibleobject.securesettings.plugin.extra.CMD_STDOUT-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.CMD_STDOUT-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_TO_RUN>ndc resolver flushnet wlan0</com.intangibleobject.securesettings.plugin.extra.CMD_TO_RUN>
<com.intangibleobject.securesettings.plugin.extra.CMD_TO_RUN-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.CMD_TO_RUN-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_USES_ROOT>true</com.intangibleobject.securesettings.plugin.extra.CMD_USES_ROOT>
<com.intangibleobject.securesettings.plugin.extra.CMD_USES_ROOT-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.CMD_USES_ROOT-type>
<com.intangibleobject.securesettings.plugin.extra.KEEP_DEVICE_AWAKE>false</com.intangibleobject.securesettings.plugin.extra.KEEP_DEVICE_AWAKE>
<com.intangibleobject.securesettings.plugin.extra.KEEP_DEVICE_AWAKE-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.KEEP_DEVICE_AWAKE-type>
<com.intangibleobject.securesettings.plugin.extra.SETTING>run_cmd</com.intangibleobject.securesettings.plugin.extra.SETTING>
<com.intangibleobject.securesettings.plugin.extra.SETTING-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.SETTING-type>
<com.twofortyfouram.locale.intent.extra.BLURB>Clear DNS Cache (Root)</com.twofortyfouram.locale.intent.extra.BLURB>
<com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
<net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
<net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
</Vals>
</Bundle>
<Str sr="arg1" ve="3">com.intangibleobject.securesettings.plugin</Str>
<Str sr="arg2" ve="3">Secure Settings</Str>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act3" ve="7">
<code>35</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="1"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%STD_OUT</lhs>
<op>12</op>
<rhs></rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act4" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%STD_OUT</lhs>
<op>2</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act5" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">DNS cache cleared</Str>
<Int sr="arg1" val="1"/>
</Action>
<Action sr="act6" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">Output: %STD_OUT</Str>
<Int sr="arg1" val="1"/>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%STD_OUT</lhs>
<op>12</op>
<rhs></rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act7" ve="7">
<code>38</code>
</Action>
<Action sr="act8" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%STD_OUT</lhs>
<op>3</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act9" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">DNS cache not cleared.</Str>
<Int sr="arg1" val="1"/>
</Action>
<Img sr="icn" ve="2">
<nme>cust_transparent</nme>
</Img>
</Task>
</TaskerData>

Below is the XML code for the Clear DNS Cache Tasker profile for KitKat.

<TaskerData sr="" dvi="1" tv="4.7u3m">
<Profile sr="prof104" ve="2">
<cdate>1433614485961</cdate>
<clp>true</clp>
<edate>1441845938993</edate>
<id>104</id>
<mid0>101</mid0>
<nme>Clear DNS Cache</nme>
<Event sr="con0" ve="2">
<code>25022</code>
<pri>0</pri>
<Bundle sr="arg0">
<Vals sr="val">
<com.twofortyfouram.locale.intent.extra.BLURB>from "AdAway"
with "AdAway: Applying…" in title.with "Applying hosts file" in text.with "AdAway: Applying…" in ticker.

Variables list:
%nw_pkgName	Package name
%nw_tag	Tag
%nw_id	Id
%nw_title	Title
%nw_text	Text
%nw_ticker	Ticker
%nw_line_1	The 1st string
%nw_line_2	The 2nd string
%nw_line_X	…</com.twofortyfouram.locale.intent.extra.BLURB>
<com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
<net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
<net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
<net.zalio.android.tasker.notification.FILFER_MODE>normal_mode</net.zalio.android.tasker.notification.FILFER_MODE>
<net.zalio.android.tasker.notification.FILFER_MODE-type>java.lang.String</net.zalio.android.tasker.notification.FILFER_MODE-type>
<net.zalio.android.tasker.notification.PACKAGE_NAME>org.adaway</net.zalio.android.tasker.notification.PACKAGE_NAME>
<net.zalio.android.tasker.notification.PACKAGE_NAME-type>java.lang.String</net.zalio.android.tasker.notification.PACKAGE_NAME-type>
<net.zalio.android.tasker.notification.TEXT_CONTAINS_TEXT>Applying hosts file</net.zalio.android.tasker.notification.TEXT_CONTAINS_TEXT>
<net.zalio.android.tasker.notification.TEXT_CONTAINS_TEXT-type>java.lang.String</net.zalio.android.tasker.notification.TEXT_CONTAINS_TEXT-type>
<net.zalio.android.tasker.notification.TICKER_CONTAINS_TEXT>AdAway: Applying…</net.zalio.android.tasker.notification.TICKER_CONTAINS_TEXT>
<net.zalio.android.tasker.notification.TICKER_CONTAINS_TEXT-type>java.lang.String</net.zalio.android.tasker.notification.TICKER_CONTAINS_TEXT-type>
<net.zalio.android.tasker.notification.TITLE_CONTAINS_TEXT>AdAway: Applying…</net.zalio.android.tasker.notification.TITLE_CONTAINS_TEXT>
<net.zalio.android.tasker.notification.TITLE_CONTAINS_TEXT-type>java.lang.String</net.zalio.android.tasker.notification.TITLE_CONTAINS_TEXT-type>
<net.zalio.android.tasker.notification.WATCH_REMOVAL>false</net.zalio.android.tasker.notification.WATCH_REMOVAL>
<net.zalio.android.tasker.notification.WATCH_REMOVAL-type>java.lang.Boolean</net.zalio.android.tasker.notification.WATCH_REMOVAL-type>
</Vals>
</Bundle>
<Str sr="arg1" ve="3">net.zalio.android.tasker.notification</Str>
<Str sr="arg2" ve="3">Notification Watch</Str>
</Event>
</Profile>
<Task sr="task101">
<cdate>1433575256216</cdate>
<edate>1441845938993</edate>
<id>101</id>
<nme>Clear DNS Cache</nme>
<pri>100</pri>
<Kid sr="Kid">
<launchID>101</launchID>
<pkg>com.misterpyrrhuloxia.clearcache</pkg>
<vnme>1.0</vnme>
<vnum>2</vnum>
</Kid>
<Action sr="act0" ve="7">
<code>549</code>
<Str sr="arg0" ve="3">%STD_OUT</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act1" ve="7">
<code>30</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="15"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act10" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">Output: %STD_OUT</Str>
<Int sr="arg1" val="1"/>
</Action>
<Action sr="act11" ve="7">
<code>38</code>
</Action>
<Action sr="act2" ve="7">
<code>11820</code>
<Bundle sr="arg0">
<Vals sr="val">
<com.intangibleobject.securesettings.plugin.extra.BLURB>Clear DNS Cache (Root)</com.intangibleobject.securesettings.plugin.extra.BLURB>
<com.intangibleobject.securesettings.plugin.extra.BLURB-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.BLURB-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_OUTPUT>false</com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_OUTPUT>
<com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_OUTPUT-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_OUTPUT-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_TOAST>false</com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_TOAST>
<com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_TOAST-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_TOAST-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_NAME>Clear DNS Cache</com.intangibleobject.securesettings.plugin.extra.CMD_NAME>
<com.intangibleobject.securesettings.plugin.extra.CMD_NAME-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.CMD_NAME-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_REPLACE_VARS>false</com.intangibleobject.securesettings.plugin.extra.CMD_REPLACE_VARS>
<com.intangibleobject.securesettings.plugin.extra.CMD_REPLACE_VARS-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.CMD_REPLACE_VARS-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_STDOUT>%STD_OUT</com.intangibleobject.securesettings.plugin.extra.CMD_STDOUT>
<com.intangibleobject.securesettings.plugin.extra.CMD_STDOUT-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.CMD_STDOUT-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_TO_RUN>ndc resolver flushdefaultif</com.intangibleobject.securesettings.plugin.extra.CMD_TO_RUN>
<com.intangibleobject.securesettings.plugin.extra.CMD_TO_RUN-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.CMD_TO_RUN-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_USES_ROOT>true</com.intangibleobject.securesettings.plugin.extra.CMD_USES_ROOT>
<com.intangibleobject.securesettings.plugin.extra.CMD_USES_ROOT-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.CMD_USES_ROOT-type>
<com.intangibleobject.securesettings.plugin.extra.KEEP_DEVICE_AWAKE>false</com.intangibleobject.securesettings.plugin.extra.KEEP_DEVICE_AWAKE>
<com.intangibleobject.securesettings.plugin.extra.KEEP_DEVICE_AWAKE-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.KEEP_DEVICE_AWAKE-type>
<com.intangibleobject.securesettings.plugin.extra.SETTING>run_cmd</com.intangibleobject.securesettings.plugin.extra.SETTING>
<com.intangibleobject.securesettings.plugin.extra.SETTING-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.SETTING-type>
<com.twofortyfouram.locale.intent.extra.BLURB>Clear DNS Cache (Root)</com.twofortyfouram.locale.intent.extra.BLURB>
<com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
<net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
<net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
</Vals>
</Bundle>
<Str sr="arg1" ve="3">com.intangibleobject.securesettings.plugin</Str>
<Str sr="arg2" ve="3">Secure Settings</Str>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act3" ve="7">
<code>35</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="1"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%STD_OUT</lhs>
<op>12</op>
<rhs></rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act4" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%STD_OUT</lhs>
<op>2</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act5" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">DNS cache cleared</Str>
<Int sr="arg1" val="1"/>
</Action>
<Action sr="act6" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">Output: %STD_OUT</Str>
<Int sr="arg1" val="1"/>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%STD_OUT</lhs>
<op>12</op>
<rhs></rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act7" ve="7">
<code>38</code>
</Action>
<Action sr="act8" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%STD_OUT</lhs>
<op>3</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act9" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">DNS cache not cleared.</Str>
<Int sr="arg1" val="1"/>
</Action>
<Img sr="icn" ve="2">
<nme>cust_transparent</nme>
</Img>
</Task>
</TaskerData>

The only difference between the Lollipop and KitKat Profiles are the shell commands:

Lollipop​

ndc resolver flushnet wlan0

KitKat​

ndc resolver flushdefaultif

Now I haven't tried running that KitKat shell command on any Android version prior to 4.4. But I don't think it would hurt to try. If it doesn't work on your phone below Android 4.4 then it must mean that the shell command changed from Jellybean to KitKat.

Good luck and hit thanks if this helped you out! :D

Update: I just uploaded two zips that contain the Lollipop and KitKat .prf.xml files. These are not flashable zips! Just download the one you need, extract it, then import it into Tasker like normal.