julian-klode / dns66

DNS-based Host Blocker (and lightweight ad blocker) for Android
https://jak-linux.org/projects/dns66/
GNU General Public License v3.0
2.1k stars 200 forks source link

Tasker support #146

Open beatschubser opened 7 years ago

beatschubser commented 7 years ago

A couple of feature ideas that would be great to have:

  1. Quick settings tile to (de-)activate the service with a single tap
  2. Tasker support for the same reason. For example, I'd like to disable DNS66 whenever I'm connected to my home WiFi since I'm running my own DNS Adblocker there (Pi-Hole). Tasker support would make this very easy.
  3. A simple logging-feature would be nice to see how many ads have been blocked today and how much of the total traffic they made.
julian-klode commented 7 years ago

We already have bugs for 1 and 3: #62 and #35 - I'm not sure what I'm supposed to do about 2 - doesn't that work already (figure out which intents to send and send them?).

beatschubser commented 7 years ago

Do you know how to find out the correct intents? The only method I know in Tasker is to select "Load Application" and long press on the app to see the available intents. There's just one for DNS66 called "MainActivity".

julian-klode commented 7 years ago

No, I don't know anything about tasker. If someone figures out what to do, I'm ready to make it work.

blueshiftlabs commented 7 years ago

This is the developer documentation for Tasker tasks. A good place to start would probably be an action plugin that can start, stop, and pause DNS66. You can do that pretty easily from within the app by sending a startService to AdVpnService, but it's not something that can be done externally because AdVpnService is protected by android.permission.BIND_VPN_SERVICE.

julian-klode commented 7 years ago

That's really not a documentation, that's a confusing page that is half-broken. Basically the only link there is TaskerPlugin.java, and that does not have a license, and it's unclear what that does. The rest links to some "Locale" app framework thingy.

blueshiftlabs commented 7 years ago

Tasker's plugin API is based on Locale's plugin API. Locale came first, but Tasker was a lot more powerful, and got more traction. If you write a Locale-compatible plugin, it will automatically work with Tasker.

The Locale plugin SDK, the sample setting plugin, and sample condition plugin are all licensed Apache 2.0. The Locale developer documentation also seems quite comprehensive.

misku commented 6 years ago

+1 for Tasker support. Once DNS66 is running its VPN, Tasker doesn't seem to be recognizing the WIFI SSID anymore. As a result, profiles like e.g. "phone connects/disconnects to/from a WIFI with SSD X" will not work.

winnieXY commented 6 years ago

So according to the Manifest there is a org.jak_linux.dns66.vpn.AdVpnService intent which should start/stop the blocker. However if i try to toogle this intent via tasker nothing happens. I add as "extra" Argument: "COMMAND:1" for stopping and "COMMAND:0" for starting.

My complete Settings in tasker: Action: org.jak_linux.dns66.vpn.AdVpnService Type: None Mime: Data: Extra: COMMAND:1 Paket: org.jak_linux.dns66 target: service

Could you please tell me what is wrong?

PheiPheiPhei commented 6 years ago

@winnieXY did you get it working?

winnieXY commented 6 years ago

no - as written by blueshiftlabs on 20 Jun, this can't be done sadly externally up to now.

febs commented 6 years ago

I'd also love to be able to automate dns66 with tasker. Thanks for the great app!

immanuelfodor commented 5 years ago

Hi Guys, why https://github.com/julian-klode/dns66/pull/280 has not been merged, is this really a matter of not enough coverage tests? Tasker support would take this app to the next level of usability.

FaserF commented 5 years ago

Hey. Any news to tasker support? I would really love to see this.

beeguy1234 commented 4 years ago

I got Tasker support working in my fork today.

A Tasker plugin has been used https://github.com/julian-klode/dns66/pull/280/commits but it is overly complicated for my purpose. I'm just using intents to issue commands from Tasker (start/stop/pause/resume) and to update status to Tasker.

For the status updates I have added sendBroadcast(intent) to AdVpnService.java. Not sure it is the best way to hook the status updates because I haven't studied the code for long. Appears to be working well though. Check out my fork if you're interested.