I’m asking for Android specifically, but I’m curious what else is out there.
For example, some apps work without internet but may use it if it’s available. I might want to block that without having to turn off wifi, force stopping it, and wiping the cache/data.
Similarly, maybe I only want to use the app over a VPN and want to prevent accidentally opening it without first turning the VPN on.
You could try NextDNS. It won’t let you designate access per app, but you can create custom blocklists. Short-term logging makes it easy to see at a glance which domains are being requested, and it doesn’t take long to get it all set up so that your apps only contact stuff which is strictly necessary in your view. Also comes with many blocklists to choose from, as well as other useful settings.
deleted by creator
There’s a built-in network toggle for applications (in their respective App Info / Permissions page) in GrapheneOS. So, if you’re on Graphene, it’s a piece of cake.
Else, you might want to look into NetGuard (https://f-droid.org/packages/eu.faircode.netguard/), which offers app-wise internet blocking.
As for the “using app over a VPN” thing, you can just turn on “Always-on VPN” and “Block connections without VPN” toggles in Settings / Network and Internet / VPN / <Your-VPN-Settings>.
You should be able to kind of do both through android settings
Settings -> Apps -> YourApp -> Mobile data usage -> Allow Network access and Mobile Data
For VPN you’ll need to add a VPN and then Settings -> Network and Internet -> VPN -> YourVPN -> Always on VPN and Block Connections without VPN. This blocks all apps. There is 2 issues with this though, Blocking connections will block split tunneling connections set up through VPNs and also potentially this depending on the apps you’re using https://mullvad.net/en/blog/dns-traffic-can-leak-outside-the-vpn-tunnel-on-android
Does not work on samsung
To prevent it using Internet at all, you can turn off individual apps access to WiFi and mobile data easily
To bind to a VPN, I use protonVPN, and I’m pretty sure the Android app has the split tunnelling feature to allow this as well. Not sure if that protects against leaks, but you could just have the VPN on all the time and use androids VPN settings to prevent any data usage outside the VPN
Netguard is a FOSS Android app which kinda works like a firewall. You can allow/block network access on a per-application basis. You can limit access e.g. on WiFi or on mobile etc. It also supports blocklists, supplementing your ad blocker.
To the Android OS, Netguard acts as if it were a VPN.
Limitations:
- if you want to filter Android system services, you will break things. You will need to spend some time to do it right.
- Chaining it to another VPN is only possible via SOCKS proxy
- if you want to route some app’s traffic via VPN and others not, I think that is not possible. You could, however, manually turn off an app’s internet connection before disconnecting the VPN, if that is not too error-prone for you.
The app is very stable, I have been using it for about 5 years without problems. For most use cases it is fire-and-forget, i.e. I rarely open the app any more.
I use it too and I like it, but OP needs to keep in mind that the apps that rely on Google Play Services will still have “Internet access” directly with it and Netguard can’t do anything about it. WhatsApp for example: you can block Internet access to the apps, but it will still be able to send/receive messages.
Came here to say NetGuard, too.
I did the allowlist approach and first blocked all and everything and then fiddled with the permissions and now have a good set of settings for stock Android. It’s doable within a few days while regularly using the devices and then allowing things as soon as you notice something does not work as expected.
Not for android, but I use this for PC:
Tracker Control - it basically checks for trackers that the apps use, and you can block internet access for individual apps. It’s also on f-droid.
What are those trackers? Can it block apps from using Google Play Services?
https://nordvpn.com/blog/what-are-trackers/
I haven’t noticed any problems, but you could, technically, block certain functions…but as long as long as you don’t go into advanced menus, you’re good
Oh, I see, , “normal” tracker. I’ve asked because I thought it could be something different since the OP was asking to block Internet and not the tracker. I’ve had a look at the app and it doesn’t seems to me that it can block Internet access to other apps.
Yes you can block the internet
From what I’ve seen, it can block the Internet for all the OS, not for single apps. But I’m not using that app, so I may be wrong.
In the picture its blocking the internet for a single app - that app being “blinkist”. You mean you want to block Google Play only?
Oh, I see! I missed that. Is it possible to block the Internet to Google Play Services?
On Android, there’s a VPN in f Droid that acts as a firewall, so you can say this app has internet this app doesn’t have internet
To ensure that this program only works with a VPN, you can set up a work profile require always on VPN in the Android settings, then this app running in the work profile must use the VPN no matter what
GrapheneOS has the internet kill switch built in for any app anywhere.
Depending on your threat model, you need to be very careful, just because an app doesn’t have direct internet access, doesn’t mean it can’t talk to Google Play and pass messages that way. In the Android model, apps can talk to each other consensually, and you can’t stop that
For desktop computers, we’d be talking about virtual machines and network names bases to enforce your policy rules. Qubes is the gold standard here.
With ”there is a VPN in F-Droid", do you happen to refer to Netguard? https://lemmy.sdf.org/comment/11993547
I’m not sure. That might be it.
I use grapheneos so I can just turn off network access in the app info panel and still use my VPN.
I also came across this one, but I haven’t heard of this one before. I’ve heard Netguard mentioned in the past
Rethink: DNS + Firewall + VPN (Firewall apps, use WireGuard VPN, monitor network, block malware, change DNS.)
Been using it for a while, and am pretty happy with it. It has some nice features, and works pretty well for me, so I’d recommend giving it a try. I believe it, unfortunately, doesn’t support OVPN though. But as I understand Wireguard are to be preferred over OVPN anyways.
With RethinkDNS you can block an app completely, allow the app (WiFi, cellular, or both) and block certain domains. You can also use DNS block lists, force or exclude apps from either VPN or Orbot. Block apps not in use, block when DNS is bypassed. A bunch more stuff.
Aside from what the others said, my VPN (also on GOS) has a kill switch function, i set it to maximum and this way the phone simply can’t connect to the internet at all unless it uses the VPN.