FORUMS
Remove All Ads from XDA

AdBlocker Quick Settings Tile [AppFactory apk and Tasker XML]

191 posts
Thanks Meter: 192
 
By mkhcb, Senior Member on 13th February 2018, 08:29 PM
Post Reply Email Thread
Often times, I see myself having to disable AdAway to use a Google Shopping or a Slickdeals link. This involved a process of exiting my browser, launching AdAway, disabling AdAway, going back to the browser, opening the desired link and then re-enable AdAway through the same process of exiting the browser to open AdAway again. Surely there was a simpler method! Attached below, I have posted a Tasker xml file that adds a Quick Setting tile to your system and allows users to enable/disable their AdBlocker. This uses the same sources as AdAway, but works independent of the app. Therefore, you don't need AdAway for this to work.

I have also included a compiled APK, using Tasker's AppFactory, for you fiscal conservatives who don't want to buy Tasker.
Coming soon: A unique icon....


To note, if you are using systemless root, like MagiskSU, you must enable systemless hosts in the settings of MagiskSU/root client.

Special thanks to my telegram pals Armando and Esperanza, for their help in testing the task.
Another special thanks to Armando for the app icon.

For those afraid of the download button, a copy of the xml file can be found below:
Code:
<TaskerData sr="" dvi="1" tv="5.1m">
	<Task sr="task2">
		<cdate>1496603118566</cdate>
		<edate>1518881841270</edate>
		<id>2</id>
		<nme>AdBlocker</nme>
		<pri>100</pri>
		<Kid sr="Kid">
			<launchID>2</launchID>
			<pkg>rxb.srv.ila</pkg>
			<vnme>v11</vnme>
			<vnum>11</vnum>
		</Kid>
		<Action sr="act0" ve="7">
			<code>342</code>
			<Int sr="arg0" val="5"/>
			<Str sr="arg1" ve="3">/sdcard/AdBlocker/status/status.txt</Str>
			<Str sr="arg2" ve="3">%old_status</Str>
			<Int sr="arg3" val="0"/>
		</Action>
		<Action sr="act1" ve="7">
			<code>37</code>
			<ConditionList sr="if">
				<Condition sr="c0" ve="3">
					<lhs>%old_status</lhs>
					<op>2</op>
					<rhs>false</rhs>
				</Condition>
			</ConditionList>
		</Action>
		<Action sr="act10" ve="7">
			<code>512</code>
			<Int sr="arg0" val="1"/>
		</Action>
		<Action sr="act11" ve="7">
			<code>548</code>
			<Str sr="arg0" ve="3">Enabling AdBlocker</Str>
			<Int sr="arg1" val="0"/>
		</Action>
		<Action sr="act12" ve="7">
			<code>162</code>
			<Int sr="arg0" val="1"/>
			<Str sr="arg1" ve="3">AdBlocker</Str>
			<Int sr="arg2" val="0"/>
		</Action>
		<Action sr="act13" ve="7">
			<code>118</code>
			<Str sr="arg0" ve="3">https://adaway.org/hosts.txt</Str>
			<Str sr="arg1" ve="3"/>
			<Str sr="arg2" ve="3"/>
			<Str sr="arg3" ve="3"/>
			<Str sr="arg4" ve="3"/>
			<Int sr="arg5" val="10"/>
			<Str sr="arg6" ve="3"/>
			<Str sr="arg7" ve="3">/sdcard/AdBlocker/adaway.txt</Str>
			<Int sr="arg8" val="0"/>
		</Action>
		<Action sr="act14" ve="7">
			<code>118</code>
			<Str sr="arg0" ve="3">http://winhelp2002.mvps.org/hosts.txt</Str>
			<Str sr="arg1" ve="3"/>
			<Str sr="arg2" ve="3"/>
			<Str sr="arg3" ve="3"/>
			<Str sr="arg4" ve="3"/>
			<Int sr="arg5" val="10"/>
			<Str sr="arg6" ve="3"/>
			<Str sr="arg7" ve="3">/sdcard/AdBlocker/mvps.txt</Str>
			<Int sr="arg8" val="0"/>
		</Action>
		<Action sr="act15" ve="7">
			<code>118</code>
			<Str sr="arg0" ve="3">http://hosts-file.net/.%5Cad_servers.txt</Str>
			<Str sr="arg1" ve="3"/>
			<Str sr="arg2" ve="3"/>
			<Str sr="arg3" ve="3"/>
			<Str sr="arg4" ve="3"/>
			<Int sr="arg5" val="10"/>
			<Str sr="arg6" ve="3"/>
			<Str sr="arg7" ve="3">/sdcard/AdBlocker/hphosts.txt</Str>
			<Int sr="arg8" val="0"/>
		</Action>
		<Action sr="act16" ve="7">
			<code>118</code>
			<Str sr="arg0" ve="3">http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&amp;showintro=0&amp;mimetype=plaintext</Str>
			<Str sr="arg1" ve="3"/>
			<Str sr="arg2" ve="3"/>
			<Str sr="arg3" ve="3"/>
			<Str sr="arg4" ve="3"/>
			<Int sr="arg5" val="10"/>
			<Str sr="arg6" ve="3"/>
			<Str sr="arg7" ve="3">/sdcard/AdBlocker/yoyos.txt</Str>
			<Int sr="arg8" val="0"/>
		</Action>
		<Action sr="act17" ve="7">
			<code>123</code>
			<Str sr="arg0" ve="3">sort -u /sdcard/AdBlocker/*.txt &gt; /etc/hosts</Str>
			<Int sr="arg1" val="0"/>
			<Int sr="arg2" val="1"/>
			<Str sr="arg3" ve="3"/>
			<Str sr="arg4" ve="3"/>
			<Str sr="arg5" ve="3"/>
		</Action>
		<Action sr="act18" ve="7">
			<code>410</code>
			<Str sr="arg0" ve="3">/sdcard/AdBlocker/status/status.txt</Str>
			<Str sr="arg1" ve="3">2</Str>
			<Int sr="arg2" val="0"/>
			<Int sr="arg3" val="0"/>
		</Action>
		<Action sr="act19" ve="7">
			<code>548</code>
			<Str sr="arg0" ve="3">AdBlocker Enabled</Str>
			<Int sr="arg1" val="0"/>
		</Action>
		<Action sr="act2" ve="7">
			<code>548</code>
			<Str sr="arg0" ve="3">Creating Directories</Str>
			<Int sr="arg1" val="0"/>
		</Action>
		<Action sr="act20" ve="7">
			<code>43</code>
			<ConditionList sr="if">
				<Condition sr="c0" ve="3">
					<lhs>%status</lhs>
					<op>2</op>
					<rhs>2</rhs>
				</Condition>
			</ConditionList>
		</Action>
		<Action sr="act21" ve="7">
			<code>512</code>
			<Int sr="arg0" val="1"/>
		</Action>
		<Action sr="act22" ve="7">
			<code>548</code>
			<Str sr="arg0" ve="3">Disabling AdBlocker</Str>
			<Int sr="arg1" val="0"/>
		</Action>
		<Action sr="act23" ve="7">
			<code>162</code>
			<Int sr="arg0" val="1"/>
			<Str sr="arg1" ve="3">AdBlocker</Str>
			<Int sr="arg2" val="1"/>
		</Action>
		<Action sr="act24" ve="7">
			<code>123</code>
			<Str sr="arg0" ve="3">truncate -s0 /etc/hosts</Str>
			<Int sr="arg1" val="0"/>
			<Int sr="arg2" val="1"/>
			<Str sr="arg3" ve="3"/>
			<Str sr="arg4" ve="3"/>
			<Str sr="arg5" ve="3"/>
		</Action>
		<Action sr="act25" ve="7">
			<code>123</code>
			<Str sr="arg0" ve="3">echo "127.0.0.1 localhost
::1 localhost" &gt;&gt; /etc/hosts</Str>
			<Int sr="arg1" val="0"/>
			<Int sr="arg2" val="1"/>
			<Str sr="arg3" ve="3"/>
			<Str sr="arg4" ve="3"/>
			<Str sr="arg5" ve="3"/>
		</Action>
		<Action sr="act26" ve="7">
			<code>410</code>
			<Str sr="arg0" ve="3">/sdcard/AdBlocker/status/status.txt</Str>
			<Str sr="arg1" ve="3">1</Str>
			<Int sr="arg2" val="0"/>
			<Int sr="arg3" val="0"/>
		</Action>
		<Action sr="act27" ve="7">
			<code>548</code>
			<Str sr="arg0" ve="3">AdBlocker Disabled</Str>
			<Int sr="arg1" val="0"/>
		</Action>
		<Action sr="act28" ve="7">
			<code>38</code>
		</Action>
		<Action sr="act3" ve="7">
			<code>409</code>
			<Str sr="arg0" ve="3">/sdcard/AdBlocker</Str>
			<Int sr="arg1" val="0"/>
			<Int sr="arg2" val="0"/>
		</Action>
		<Action sr="act4" ve="7">
			<code>409</code>
			<Str sr="arg0" ve="3">/sdcard/AdBlocker/status</Str>
			<Int sr="arg1" val="0"/>
			<Int sr="arg2" val="0"/>
		</Action>
		<Action sr="act5" ve="7">
			<code>410</code>
			<Str sr="arg0" ve="3">/sdcard/AdBlocker/status/status.txt</Str>
			<Str sr="arg1" ve="3">1</Str>
			<Int sr="arg2" val="0"/>
			<Int sr="arg3" val="0"/>
		</Action>
		<Action sr="act6" ve="7">
			<code>135</code>
			<Int sr="arg0" val="0"/>
			<Int sr="arg1" val="1"/>
			<Str sr="arg2" ve="3"/>
		</Action>
		<Action sr="act7" ve="7">
			<code>43</code>
		</Action>
		<Action sr="act8" ve="7">
			<code>417</code>
			<Str sr="arg0" ve="3">/sdcard/AdBlocker/status/status.txt</Str>
			<Str sr="arg1" ve="3">%status</Str>
		</Action>
		<Action sr="act9" ve="7">
			<code>37</code>
			<ConditionList sr="if">
				<Condition sr="c0" ve="3">
					<lhs>%status</lhs>
					<op>2</op>
					<rhs>1</rhs>
				</Condition>
			</ConditionList>
		</Action>
		<Img sr="icn" ve="2">
			<uri>content://com.android.providers.downloads.documents/document/478</uri>
		</Img>
	</Task>
</TaskerData>

If you are using the tasker xml, please navigate to: Tasker> Preferences> Action> and add "AdBlocker" to the 2nd quick settings task.


Per request, here is a telegram group for feature discussion: http://t.me/taskerAdBlocker
Attached Thumbnails
Click image for larger version

Name:	Screenshot_20180213-181415.jpg
Views:	7512
Size:	140.0 KB
ID:	4419245   Click image for larger version

Name:	Screenshot_20180213-180753.jpg
Views:	7496
Size:	217.0 KB
ID:	4419247   Click image for larger version

Name:	Screenshot_20180213-180834.jpg
Views:	7498
Size:	172.5 KB
ID:	4419248   Click image for larger version

Name:	Screenshot_20180213-180925.jpg
Views:	7104
Size:	201.5 KB
ID:	4419249   Click image for larger version

Name:	Screenshot_20180213-180936.jpg
Views:	6874
Size:	154.5 KB
ID:	4419250   Click image for larger version

Name:	Screenshot_20180302-221441.jpg
Views:	4160
Size:	171.7 KB
ID:	4435808  
Attached Files
File Type: xml AdBlocker.tsk.xml - [Click for QR Code] (8.5 KB, 2016 views)
File Type: apk AdBlocker.11.apk - [Click for QR Code] (2.50 MB, 1888 views)
File Type: apk AdBlocker.16.apk - [Click for QR Code] (2.47 MB, 594 views)
File Type: apk AdBlocker.20.apk - [Click for QR Code] (2.47 MB, 4508 views)
The Following 48 Users Say Thank You to mkhcb For This Useful Post: [ View ] Gift mkhcb Ad-Free
 
 
13th February 2018, 09:55 PM |#2  
Junior Member
Flag Niter├│i
Thanks Meter: 19
 
More
Best adaway app I have ever used! Simple and effective! Works amazingly well! Congratulations to the Dev!! And thank you for sharing this amazing app with us!
The Following User Says Thank You to EsperanzaHz For This Useful Post: [ View ] Gift EsperanzaHz Ad-Free
13th February 2018, 10:24 PM |#3  
MishaalRahman's Avatar
Editor in Chief
Thanks Meter: 1,396
 
More
Can you post some screenshots of the QS tile, and the Profile in Tasker?
13th February 2018, 11:11 PM |#4  
OP Senior Member
Thanks Meter: 192
 
More
Quote:
Originally Posted by MishaalRahman

Can you post some screenshots of the QS tile, and the Profile in Tasker?

Done
Attached Thumbnails
Click image for larger version

Name:	Screenshot_20180213-180741.jpg
Views:	2764
Size:	139.4 KB
ID:	4419238   Click image for larger version

Name:	Screenshot_20180213-180753.jpg
Views:	2724
Size:	217.0 KB
ID:	4419239   Click image for larger version

Name:	Screenshot_20180213-180925.jpg
Views:	2722
Size:	201.5 KB
ID:	4419240   Click image for larger version

Name:	Screenshot_20180213-180936.jpg
Views:	2606
Size:	154.5 KB
ID:	4419241   Click image for larger version

Name:	Screenshot_20180213-180834.jpg
Views:	2572
Size:	172.5 KB
ID:	4419242   Click image for larger version

Name:	Screenshot_20180213-181415.jpg
Views:	2510
Size:	140.0 KB
ID:	4419244  
15th February 2018, 12:16 AM |#5  
Senior Member
Flag Pahang
Thanks Meter: 61
 
More
Perhaps, you can make hide option for the icon.
The Following User Says Thank You to BlueSky_Vincent For This Useful Post: [ View ] Gift BlueSky_Vincent Ad-Free
15th February 2018, 12:35 AM |#6  
bagarwa's Avatar
Senior Member
Flag Bothell
Thanks Meter: 2,738
 
More
Exclamation
I have a Pixel 2XL, stock Android 8.1 Feb, Magisk 15.4. I do have AdAway installed + enabled and I have systemless hosts enabled in the settings of Magisk Manager.

I imported the AdBlocker task via your xml to my Tasker. Tapped the check mark of the task configuration screen, got the "Applied" toast msg. And yet, I don't see an AdBlocker QS tile in the QS edit panel.

I went to the AdBlocker task configuration page again and tapped the run ( |> ) button at bottom left. The task ran, I got the "AdBlocker enabled" toast. I get "Disabled" in AdAway app. I tap the run button again, I get the "AdBlocker disabled" toast. AdAway still says "Disabled".

And still no AdBlocker QS tile in the QS edit panel.

I'm guessing I'm doing something wrong. Could you please let me know what?
15th February 2018, 01:55 AM |#7  
buffal0b1ll's Avatar
Senior Member
Flag Baltimore
Thanks Meter: 3,626
 
More
Quote:
Originally Posted by bagarwa

I have a Pixel 2XL, stock Android 8.1 Feb, Magisk 15.4. I do have AdAway installed + enabled and I have systemless hosts enabled in the settings of Magisk Manager.

I imported the AdBlocker task via your xml to my Tasker. Tapped the check mark of the task configuration screen, got the "Applied" toast msg. And yet, I don't see an AdBlocker QS tile in the QS edit panel.

I went to the AdBlocker task configuration page again and tapped the run ( |> ) button at bottom left. The task ran, I got the "AdBlocker enabled" toast. I get "Disabled" in AdAway app. I tap the run button again, I get the "AdBlocker disabled" toast. AdAway still says "Disabled".

And still no AdBlocker QS tile in the QS edit panel.

I'm guessing I'm doing something wrong. Could you please let me know what?

Drag the first Unset Tasker tile up to the active QS tiles section. This works independent of AdAway so don't expect the status to toggle back to enabled in AdAway when the tile activates AdBlocking. I found that I had to close and reopen chrome to test that the ad blocking was indeed turned off (probably because of caching). And then again after turning it back on. It works a treat. Now to decide if I want to give up AdAway webserver functionality and use this tile as my Adblock solution as a daily driver.
15th February 2018, 02:04 AM |#8  
Senior Member
Flag Jaitaran
Thanks Meter: 92
 
Donate to Me
More
Soryy i did not get the process. Could anybody pls provide Steps to implement?
15th February 2018, 02:16 AM |#9  
buffal0b1ll's Avatar
Senior Member
Flag Baltimore
Thanks Meter: 3,626
 
More
@mkhcb this is brilliant. I've always wanted an AdAway toggle and this is the next best thing Maybe even better!
I copied line 11 and inserted it as new line 22 to make the disable action collapse the quick settings panel too. I hope you'll consider adding to your version here too.
Thanks again!
Attached Thumbnails
Click image for larger version

Name:	Screenshot_20180214-211206.png
Views:	926
Size:	182.9 KB
ID:	4420403  
The Following User Says Thank You to buffal0b1ll For This Useful Post: [ View ] Gift buffal0b1ll Ad-Free
15th February 2018, 02:55 AM |#10  
OP Senior Member
Thanks Meter: 192
 
More
Quote:
Originally Posted by bagarwa

I have a Pixel 2XL, stock Android 8.1 Feb, Magisk 15.4. I do have AdAway installed + enabled and I have systemless hosts enabled in the settings of Magisk Manager.

I imported the AdBlocker task via your xml to my Tasker. Tapped the check mark of the task configuration screen, got the "Applied" toast msg. And yet, I don't see an AdBlocker QS tile in the QS edit panel.

I went to the AdBlocker task configuration page again and tapped the run ( |> ) button at bottom left. The task ran, I got the "AdBlocker enabled" toast. I get "Disabled" in AdAway app. I tap the run button again, I get the "AdBlocker disabled" toast. AdAway still says "Disabled".

And still no AdBlocker QS tile in the QS edit panel.

I'm guessing I'm doing something wrong. Could you please let me know what?

Go to Tasker settings/preferences> Action> make sure #2 says AdBlocker
The Following User Says Thank You to mkhcb For This Useful Post: [ View ] Gift mkhcb Ad-Free
15th February 2018, 03:28 AM |#11  
OP Senior Member
Thanks Meter: 192
 
More
Quote:
Originally Posted by nadeem_naddy

Soryy i did not get the process. Could anybody pls provide Steps to implement?

Do you own a copy of Tasker?

Quote:
Originally Posted by buffal0b1ll

@mkhcb this is brilliant. I've always wanted an AdAway toggle and this is the next best thing Maybe even better!
I copied line 11 and inserted it as new line 22 to make the disable action collapse the quick settings panel too. I hope you'll consider adding to your version here too.
Thanks again!

Thanks for picking that up! Away from my computer now but, I'll eventually update the main post.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes