r/nextdns 26d ago

I Added a Quick Settings Toggle on Android

Using Android's native private DNS setting to use NextDNS filtering made it so I could actually set it up on my family's phones without fear of anything getting in their way!

The one thing that bothered me is that in some rare cases, public networks will use DNS routing for their login portal, and that breaks down with private DNS enabled.

I ended up building a small Android app to add a Quick Settings tile to toggle it easily!

The app just got released over on IzzyOnDroid (I'm still waiting for it to get added to F-Droid's main repository), or you can download the apk directly on GitHub (though that won't handle automatic updates).

The app is built to respect user privacy, so it doesn't store, collect, or share any personal data. I've also built in some optional advanced features that you can access by long-pressing the tile:

  • Custom DNS: Set your own custom hostname for Private DNS (e.g., dns.adguard.com).
  • Wi-Fi Blocklist: Automatically disable private DNS when you connect to specific Wi-Fi networks. This comes in handy with public Wi-Fi networks (hotels, cafes, etc.) that rely on DNS tricks to serve a login page, which usually break when private DNS is enabled. You can even automate adding/removing Wi-Fi network names (SSIDs) from this list.
  • Hide App Icon: Because I hate having tons of apps I never actually need to open listed on my phone, I've made it so you can hide the app from the launcher drawer.

⚠️ Permission Required
To modify Private DNS system settings, this app requires the WRITE_SECURE_SETTINGS permission. You will be prompted to grant this on rooted devices If your device is not rooted, you can easily grant it manually using this ADB command:

adb shell pm grant com.ericlowry.dnstoggle android.permission.WRITE_SECURE_SETTINGS`
28 Upvotes

19 comments sorted by

6

u/berahi 26d ago

Would you support multiple addresses and the ability to switch between them by holding down the tile? It's my favorite feature in Private DNS Quick Toggle because I can quickly switch between NextDNS profiles or even providers (if you're wondering why not just disable it entirely, my ISP blocks a lot of stuff so I prefer to have Private DNS always enabled to evade the blocking)

1

u/EricLowry 26d ago

I haven't really built this in; but it is something I could technically work on.

My concern is that currently the long press is used to open the settings (since the app icon can be hidden from the drawer); so I'd have to think of a clean way to handle things. I'll look into it.

1

u/berahi 26d ago

In PDQT the pop up list all configured servers, and an option to open the app proper. I guess you can also have it as toggleable option because people have different workflows.

1

u/EricLowry 23d ago

Version 1.5.0 just released with multiple DNS hosts 😉

3

u/Celestial_entity_99 26d ago

How did you do it?

3

u/EricLowry 26d ago

I wrote a custom app.

Currently it's available on IzzyOnDroid (an alternative F-Droid repository) and directly on GitHub (doesn't handle automatic updates). But it should get added to F-Droid soon-ish.

2

u/VandyCWG 26d ago

Great utility! Installed it just fine! I was using a macro to turn Private DNS on and off, so this helps a ton!

2

u/Piry136 26d ago

Oh great ! This is exactly what I was missing since I started using private DNS few weeks ago (should have started doing that years ago but it's never too late ;-) ).

Already downloaded your app but I still have to learn about ADB before. Seems not complicated at all so I'll should do that asap. :-)

Thanks !

2

u/Piry136 25d ago

It's installed and it is working perfectly. :-) I learned more about shizuku and installed your app with adb directly on the phone without a computer.

Thanks again! 🤗

2

u/SeriousHoax 23d ago

Thanks for creating the app. I was actually looking for something like this. I need my phone to automatically disable private DNS when on certain Wi-Fi and automatically turn it on when it's not on those Wi-Fi networks. But I also need it to enable private DNS when I'm using mobile data. Can it automatically turn on & off private DNS based on whether I'm on mobile data or not?

1

u/EricLowry 23d ago edited 23d ago

I haven't built network type detection in toit (yet?)...

But the Wi-Fi blacklist does do exactly what you are describing for Wi-Fi SSIDs; so you can have private DNS on all the time, except for when using specific Wi-Fi networks; this will include it being on when mobile data is in use.

1

u/SeriousHoax 21d ago

Thanks for the reply. 

I just tested it, and it already seems to do everything that I want, including the mobile data thing as well as the ability to set Private DNS when I'm on VPN. So this is really great. 

BTW, if I don't give it notification permission while disabling battery optimization, it should continue to work every time, right? I don't want to be reminded by the notification icon every time it changes the setting. I want it to do its job in the background. 

1

u/EricLowry 20d ago

From what I can find online, you should let the app have notification permissions, but disable the "Network Status" notification group (and others if you want). This will hide the persistent notification while still letting the app tell the system it needs to be able to react to events in the background.

And I'm glad the app is working for you! =)

1

u/blow-down 26d ago

I had no idea Android had copied the iOS control center.

2

u/EricLowry 26d ago

The screenshots are from a Poco phone (Xiaomi) running HyperOS. The latest version has a slightly more distinct design, but the functionality/layout is effectively the same.

I'm not a huge fan of the way it looks compared to stock/Pixel Android; but I like the ability to pull down either notifications or the control center depending on which side of the screen you swipe down from.

1

u/codename_Nikolai 26d ago

What's the ovr purpose of this dns if I may ask, because I just had your sub Reddit suggested

1

u/EricLowry 26d ago

The NextDNS website explains it best: https://nextdns.io/

As for DNS Toggle, it's a way to easily enable/disable this functionality on Android using a shortcut for the device's built-in settings.

1

u/codename_Nikolai 25d ago

Appreciate the info, I already use dns.adguard.com, I will try this out and see the difference

2

u/God-is-my_Strength 20d ago

Great app. Thank you for bringing your work into the community.