[Android Apps and Games] Beakhole:
This is a change of subject, but I finally figured out a way to get Adaway to take effect without having to reboot.

The purpose of rebooting is to immediately clear the DNS cache. In Windows you can do it as easily as running the command "ipconfig /flushdns".

But I discovered that you can run a shell command in Lollipop and Marshmallow (haven't tested it on Nougat yet) that actually clears the DNS cache.

Here's the command:

ndc resolver flushnet wlan0

I wasn't sure if wlan0 was the only interface that that command needed to be run on, so I first ran "ifconfig" and that showed me all the interfaces.

So below is a Tasker profile I created to automatically run that command on all of my interfaces. I have a Nexus 6 on Pure Nexus 6.0.1 with ElementalX kernel.

Profile: Clear DNS Cache (108)
Priority: 32
Event: AutoNotification Intercept [ Configuration:Event Behaviour: true
Notification Type: Only Created Notifications
Notification App: AdAway (case ins)
Notification Text: Applying hosts file (case ins) ]
Enter: Clear DNS Cache (109)
A1: Variable Clear [ Name:%DnsCacheWlan0 Pattern Matching:eek:ff ]
A2: Variable Clear [ Name:%DnsCacheDummy0 Pattern Matching:eek:ff ]
A3: Variable Clear [ Name:%DnsCacheLo Pattern Matching:eek:ff ]
A4: Variable Clear [ Name:%DnsCacheRmnet_usb0 Pattern Matching:eek:ff ]
A5: Variable Clear [ Name:%DnsCacheRmnet_data0 Pattern Matching:eek:ff ]
A6: Variable Clear [ Name:%DnsCachePe Pattern Matching:eek:ff ]
A7: Wait [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ]
<wlan0>
A8: Run Shell [ Command:ndc resolver flushnet wlan0 Timeout (Seconds):0 Use Root:eek:n Store Output In:%DnsCacheWlan0 Store Errors In: Store Result In: ]
<Dummy0>
A9: Run Shell [ Command:ndc resolver flushnet dummy0 Timeout (Seconds):0 Use Root:eek:n Store Output In:%DnsCacheDummy0 Store Errors In: Store Result In: ]
<lo>
A10: Run Shell [ Command:ndc resolver flushnet lo Timeout (Seconds):0 Use Root:eek:n Store Output In:%DnsCacheLo Store Errors In: Store Result In: ]
<rmnet_usb0>
A11: Run Shell [ Command:ndc resolver flushnet rmnet_usb0 Timeout (Seconds):0 Use Root:eek:n Store Output In:%DnsCacheRmnet_usb0 Store Errors In: Store Result In: ]
<rmnet_data0>
A12: Run Shell [ Command:ndc resolver flushnet rmnet_data0 Timeout (Seconds):0 Use Root:eek:n Store Output In:%DnsCacheRmnet_data0 Store Errors In: Store Result In: ]
<pe>
A13: Run Shell [ Command:ndc resolver flushnet pe Timeout (Seconds):0 Use Root:eek:n Store Output In:%DnsCachePe Store Errors In: Store Result In: ]
A14: If [ %DnsCacheWlan0 ~ 200 0 Resolver command succeeded & %DnsCacheDummy0 ~ 200 0 Resolver command succeeded & %DnsCacheLo ~ 200 0 Resolver command succeeded & %DnsCacheRmnet_usb0 ~ 200 0 Resolver command succeeded & %DnsCacheRmnet_data0 ~ 200 0 Resolver command succeeded & %DnsCachePe ~ 200 0 Resolver command succeeded ]
A15: Notify [ Title:AdAway Text:DNS cache cleared Icon:ipack:holdlightmd:navigation_accept Number:0 Permanent:eek:ff Priority:3 ]
A16: Else If [ %DnsCacheWlan0 !~ 200 0 Resolver command succeeded ]
A17: Notify [ Title:AdAway Text:DNS cache not cleared on wlan0. %DnsCacheWlan0 Icon:hd_ab_content_remove Number:0 Permanent:eek:ff Priority:3 ]
A18: Else If [ %DnsCacheDummy0 !~ 200 0 Resolver command succeeded ]
A19: Notify [ Title:AdAway Text:DNS cache not cleared on dummy0. %DnsCacheDummy0 Icon:hd_ab_content_remove Number:0 Permanent:eek:ff Priority:3 ]
A20: Else If [ %DnsCacheLo !~ 200 0 Resolver command succeeded ]
A21: Notify [ Title:AdAway Text:DNS cache not cleared on lo. %DnsCacheLo Icon:hd_ab_content_remove Number:0 Permanent:eek:ff Priority:3 ]
A22: Else If [ %DnsCacheRmnet_usb0 !~ 200 0 Resolver command succeeded ]
A23: Notify [ Title:AdAway Text:DNS cache not cleared on rmnet_usb0. %DnsCacheRmnet_usb0 Icon:hd_ab_content_remove Number:0 Permanent:eek:ff Priority:3 ]
A24: Else If [ %DnsCacheRmnet_data0 !~ 200 0 Resolver command succeeded ]
A25: Notify [ Title:AdAway Text:DNS cache not cleared on rmnet_data0. %DnsCacheRmnet_data0 Icon:hd_ab_content_remove Number:0 Permanent:eek:ff Priority:3 ]
A26: Else If [ %DnsCachePe !~ 200 0 Resolver command succeeded ]
A27: Notify [ Title:AdAway Text:DNS cache not cleared on pe. %DnsCachePe Icon:hd_ab_content_remove Number:0 Permanent:eek:ff Priority:3 ]
A28: End If
A29: Vibrate [ Time:500 ]

Below is the xml code of the profile if you want to import it:

<TaskerData sr="" dvi="1" tv="4.9u4m">
<Profile sr="prof108" ve="2">
<cdate>1492370217523</cdate>
<edate>1492808845999</edate>
<id>108</id>
<mid0>109</mid0>
<nme>Clear DNS Cache</nme>
<pri>32</pri>
<Event sr="con0" ve="2">
<code>1520257414</code>
<pri>0</pri>
<Bundle sr="arg0">
<Vals sr="val">
<AllFields>false</AllFields>
<AllFields-type>java.lang.Boolean</AllFields-type>
<App>AdAway</App>
<App-type>java.lang.String</App-type>
<BigImageNames><null></BigImageNames>
<BigImageNames-type>java.lang.String</BigImageNames-type>
<BigTextNames><null></BigTextNames>
<BigTextNames-type>java.lang.String</BigTextNames-type>
<CaseinsensitiveApp>true</CaseinsensitiveApp>
<CaseinsensitiveApp-type>java.lang.Boolean</CaseinsensitiveApp-type>
<CaseinsensitivePackage>false</CaseinsensitivePackage>
<CaseinsensitivePackage-type>java.lang.Boolean</CaseinsensitivePackage-type>
<CaseinsensitiveText>true</CaseinsensitiveText>
<CaseinsensitiveText-type>java.lang.Boolean</CaseinsensitiveText-type>
<CaseinsensitiveTitle>false</CaseinsensitiveTitle>
<CaseinsensitiveTitle-type>java.lang.Boolean</CaseinsensitiveTitle-type>
<ExactApp>false</ExactApp>
<ExactApp-type>java.lang.Boolean</ExactApp-type>
<ExactPackage>false</ExactPackage>
<ExactPackage-type>java.lang.Boolean</ExactPackage-type>
<ExactText>false</ExactText>
<ExactText-type>java.lang.Boolean</ExactText-type>
<ExactTitle>false</ExactTitle>
<ExactTitle-type>java.lang.Boolean</ExactTitle-type>
<HasReplyAction>false</HasReplyAction>
<HasReplyAction-type>java.lang.Boolean</HasReplyAction-type>
<Id><null></Id>
<Id-type>java.lang.String</Id-type>
<ImageNames><null></ImageNames>
<ImageNames-type>java.lang.String</ImageNames-type>
<InterceptApps><StringArray sr=""/></InterceptApps>
<InterceptApps-type>[Ljava.lang.String;</InterceptApps-type>
<InterceptPersistent><null></InterceptPersistent>
<InterceptPersistent-type>java.lang.String</InterceptPersistent-type>
<InvertApp>false</InvertApp>
<InvertApp-type>java.lang.Boolean</InvertApp-type>
<InvertPackage>false</InvertPackage>
<InvertPackage-type>java.lang.Boolean</InvertPackage-type>
<InvertText>false</InvertText>
<InvertText-type>java.lang.Boolean</InvertText-type>
<InvertTitle>false</InvertTitle>
<InvertTitle-type>java.lang.Boolean</InvertTitle-type>
<PackageName><null></PackageName>
<PackageName-type>java.lang.String</PackageName-type>
<RegexApp>false</RegexApp>
<RegexApp-type>java.lang.Boolean</RegexApp-type>
<RegexPackage>false</RegexPackage>
<RegexPackage-type>java.lang.Boolean</RegexPackage-type>
<RegexText>false</RegexText>
<RegexText-type>java.lang.Boolean</RegexText-type>
<RegexTitle>false</RegexTitle>
<RegexTitle-type>java.lang.Boolean</RegexTitle-type>
<Text>Applying hosts file</Text>
<Text-type>java.lang.String</Text-type>
<TextNames><null></TextNames>
<TextNames-type>java.lang.String</TextNames-type>
<Title></Title>
<Title-type>java.lang.String</Title-type>
<Type>0</Type>
<Type-type>java.lang.String</Type-type>
<com.twofortyfouram.locale.intent.extra.BLURB>Event Behaviour: true
Notification Type: Only Created Notifications
Notification App: AdAway (case ins)
Notification Text: Applying hosts file (case ins)</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.EXTRA_NSR_DEPRECATED>true</net.dinglisch.android.tasker.EXTRA_NSR_DEPRECATED>
<net.dinglisch.android.tasker.EXTRA_NSR_DEPRECATED-type>java.lang.Boolean</net.dinglisch.android.tasker.EXTRA_NSR_DEPRECATED-type>
<net.dinglisch.android.tasker.extras.REQUESTED_TIMEOUT>0</net.dinglisch.android.tasker.extras.REQUESTED_TIMEOUT>
<net.dinglisch.android.tasker.extras.REQUESTED_TIMEOUT-type>java.lang.Integer</net.dinglisch.android.tasker.extras.REQUESTED_TIMEOUT-type>
<net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>App Text Type plugininstanceid plugintypeid </net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>
<net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-type>java.lang.String</net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-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>
<plugininstanceid>a892185a-ae4c-4767-8841-12e53a4f7221</plugininstanceid>
<plugininstanceid-type>java.lang.String</plugininstanceid-type>
<plugintypeid>com.joaomgcd.autonotification.intent.IntentInterceptNotificationEvent</plugintypeid>
<plugintypeid-type>java.lang.String</plugintypeid-type>
</Vals>
</Bundle>
<Str sr="arg1" ve="3">com.joaomgcd.autonotification</Str>
<Str sr="arg2" ve="3">com.joaomgcd.autonotification.activity.ActivityConfigNotificationInterceptTaskerEvent</Str>
</Event>
</Profile>
<Task sr="task109">
<cdate>1492370235605</cdate>
<edate>1492808845999</edate>
<id>109</id>
<nme>Clear DNS Cache</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>549</code>
<Str sr="arg0" ve="3">%DnsCacheWlan0</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act1" ve="7">
<code>549</code>
<Str sr="arg0" ve="3">%DnsCacheDummy0</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act10" ve="7">
<code>123</code>
<label>rmnet_usb0</label>
<Str sr="arg0" ve="3">ndc resolver flushnet rmnet_usb0</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="1"/>
<Str sr="arg3" ve="3">%DnsCacheRmnet_usb0</Str>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
</Action>
<Action sr="act11" ve="7">
<code>123</code>
<label>rmnet_data0</label>
<Str sr="arg0" ve="3">ndc resolver flushnet rmnet_data0</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="1"/>
<Str sr="arg3" ve="3">%DnsCacheRmnet_data0</Str>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
</Action>
<Action sr="act12" ve="7">
<code>123</code>
<label>pe</label>
<Str sr="arg0" ve="3">ndc resolver flushnet pe</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="1"/>
<Str sr="arg3" ve="3">%DnsCachePe</Str>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
</Action>
<Action sr="act13" ve="7">
<code>37</code>
<ConditionList sr="if">
<bool0>And</bool0>
<bool1>And</bool1>
<bool2>And</bool2>
<bool3>And</bool3>
<bool4>And</bool4>
<Condition sr="c0" ve="3">
<lhs>%DnsCacheWlan0</lhs>
<op>2</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
<Condition sr="c1" ve="3">
<lhs>%DnsCacheDummy0</lhs>
<op>2</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
<Condition sr="c2" ve="3">
<lhs>%DnsCacheLo</lhs>
<op>2</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
<Condition sr="c3" ve="3">
<lhs>%DnsCacheRmnet_usb0</lhs>
<op>2</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
<Condition sr="c4" ve="3">
<lhs>%DnsCacheRmnet_data0</lhs>
<op>2</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
<Condition sr="c5" ve="3">
<lhs>%DnsCachePe</lhs>
<op>2</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act14" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">AdAway</Str>
<Str sr="arg1" ve="3">DNS cache cleared</Str>
<Img sr="arg2" ve="2">
<nme>navigation_accept</nme>
<pkg>net.dinglisch.android.ipack.holdlightmd</pkg>
</Img>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
</Action>
<Action sr="act15" ve="7">
<code>43</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%DnsCacheWlan0</lhs>
<op>3</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act16" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">AdAway</Str>
<Str sr="arg1" ve="3">DNS cache not cleared on wlan0. %DnsCacheWlan0</Str>
<Img sr="arg2" ve="2">
<nme>hd_ab_content_remove</nme>
</Img>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
</Action>
<Action sr="act17" ve="7">
<code>43</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%DnsCacheDummy0</lhs>
<op>3</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act18" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">AdAway</Str>
<Str sr="arg1" ve="3">DNS cache not cleared on dummy0. %DnsCacheDummy0</Str>
<Img sr="arg2" ve="2">
<nme>hd_ab_content_remove</nme>
</Img>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
</Action>
<Action sr="act19" ve="7">
<code>43</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%DnsCacheLo</lhs>
<op>3</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act2" ve="7">
<code>549</code>
<Str sr="arg0" ve="3">%DnsCacheLo</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act20" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">AdAway</Str>
<Str sr="arg1" ve="3">DNS cache not cleared on lo. %DnsCacheLo</Str>
<Img sr="arg2" ve="2">
<nme>hd_ab_content_remove</nme>
</Img>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
</Action>
<Action sr="act21" ve="7">
<code>43</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%DnsCacheRmnet_usb0</lhs>
<op>3</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act22" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">AdAway</Str>
<Str sr="arg1" ve="3">DNS cache not cleared on rmnet_usb0. %DnsCacheRmnet_usb0</Str>
<Img sr="arg2" ve="2">
<nme>hd_ab_content_remove</nme>
</Img>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
</Action>
<Action sr="act23" ve="7">
<code>43</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%DnsCacheRmnet_data0</lhs>
<op>3</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act24" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">AdAway</Str>
<Str sr="arg1" ve="3">DNS cache not cleared on rmnet_data0. %DnsCacheRmnet_data0</Str>
<Img sr="arg2" ve="2">
<nme>hd_ab_content_remove</nme>
</Img>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
</Action>
<Action sr="act25" ve="7">
<code>43</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%DnsCachePe</lhs>
<op>3</op>
<rhs>200 0 Resolver command succeeded</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act26" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">AdAway</Str>
<Str sr="arg1" ve="3">DNS cache not cleared on pe. %DnsCachePe</Str>
<Img sr="arg2" ve="2">
<nme>hd_ab_content_remove</nme>
</Img>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
</Action>
<Action sr="act27" ve="7">
<code>38</code>
</Action>
<Action sr="act28" ve="7">
<code>61</code>
<Int sr="arg0" val="500"/>
</Action>
<Action sr="act3" ve="7">
<code>549</code>
<Str sr="arg0" ve="3">%DnsCacheRmnet_usb0</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act4" ve="7">
<code>549</code>
<Str sr="arg0" ve="3">%DnsCacheRmnet_data0</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act5" ve="7">
<code>549</code>
<Str sr="arg0" ve="3">%DnsCachePe</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act6" ve="7">
<code>30</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="5"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act7" ve="7">
<code>123</code>
<label>wlan0</label>
<Str sr="arg0" ve="3">ndc resolver flushnet wlan0</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="1"/>
<Str sr="arg3" ve="3">%DnsCacheWlan0</Str>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
</Action>
<Action sr="act8" ve="7">
<code>123</code>
<label>Dummy0</label>
<Str sr="arg0" ve="3">ndc resolver flushnet dummy0</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="1"/>
<Str sr="arg3" ve="3">%DnsCacheDummy0</Str>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
</Action>
<Action sr="act9" ve="7">
<code>123</code>
<label>lo</label>
<Str sr="arg0" ve="3">ndc resolver flushnet lo</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="1"/>
<Str sr="arg3" ve="3">%DnsCacheLo</Str>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
</Action>
<Img sr="icn" ve="2">
<cls>org.adaway.ui.BaseActivity</cls>
<pkg>org.adaway</pkg>
</Img>
</Task>
</TaskerData>

And attached below is a prf.xml file of the Tasker profile in case you're as lazy as I am when it comes to importing Tasker profiles.

View attachment 4121469

You'll need to install AutoNotification in order to use this profile. It's used for the Tasker context. It intercepts the Adaway notification when it says "Applying hosts file..."

This works perfectly for me so let me know how it works for all of you or if there's anything I can do to improve the profile.