In Android, is it possible to block apps from accessing the Internet? Many apps will often connect to remote servers in the background, including Google's own apps or system services. Over time this can eat away at a user's data limit set by a mobile carrier. Does Android allow an app to act as a firewall whereby the user can select which apps have access to the Internet? Or does the device have to be rooted to have that ability?
If you don't have root access on the device, then you can use mobiwol to control the access various apps have to the Internet. Mobiwol creates a 'virtual' VPN connection on the device which allows control of the individual app connections. However, although the app starts when the device starts it is possible that there may be a brief period prior to Mobiwol executing in which apps could get Internet access despite the Mobiwol configuration.
If you have root access, there are more alternatives:
Without rooting your device, you won't have much choice: you can either disable the network when the app runs in foreground, as LinX64 suggested – or "hibernate" (suspend) it when it goes to background (is not actively used), as suggested by Dalvik. Of course, you could combine the two – which should effectively prevent that app from accessing the network. But still on the cost of bringing your entire network connection down as soon as you want to use that app.
With root-access, things look different: there are apps available dealing with other apps' permissions, allowing you to revoke some of them after you've installed that app. That way you could e.g. revoke the permission to access mobile data and/or WiFi just from that app: Your network connection would not be affected at all (so background-checks for mail and updates in WhatsApp/Viber/Skype/SE-App would keep working) – while the app-in-question would be told "there's no network available currently" (faking a "network down" just for that app).
Meanwhile there are Internet Firewalls available which also work on non-rooted devices. Simeon already mentioned Mobiwol – but a much better choice is NetGuard, available from F-Droid as well as from Playstore. Availability at F-Droid already indicates it's Open Source (almost a must in the security sector), and it comes for free. This is up to version 2.44 (added on 2016-08-06). Later versions from the Playstore have non-free dependencies, so the app is no longer updated in F-Droid's "official" repo anymore, and will likely not be. You still can obtain up-to-date versions via my F-Droid compatible repository, though.
NetGuard (Source: Google Play; click images for larger variants)
As you can see in the first screenshot, if gives you very granular control:
- Generally forbid an app access to WiFi or mobile data
- Permit an app access to WiFi or mobile data only when screen is on
- Regardless of above settings, keep it from accessing mobile data when roaming
It's by far the best rated app in this section – and though I haven't tried it myself,
I'd say it's the one to recommend if your device is not rooted. Update: Note that recent versions of Netguard include Google Ads as well as Firebase Analytics – two things which IMHO have no business in a firewall (or any other security) application – which most likely is the reason it is no longer updated on F-Droid's official repo (still available in mine with the appropriate warnings).
With root access available, the candidate most likely is AFWall+:
AFWall+ (source: Google Play; click images for larger variants)
Like NetGuard, this app is open source (available at F-Droid and at Google Play), and allows to control internet access by WiFi and mobile data separately. But while it is more powerful in some ways, it seems to lack NetGuard's features of "screen-on" and roaming control (or I didn't see that).
Try the app No-Root Firewall. It allows you to control what apps have Internet access over both wifi and cell data. It works by setting up a VPN on your phone.
The app Droidwall will do this, but it requires a rooted android device. It works very well, though, giving you the option of allowing either cellular or wifi internet access to each app (or both or neither), as well as disabling the rules entirely while keeping the settings so you can easily give everything full normal access when desired, then go back to the rules easily without clicking a lot of options.
Afwall+ is another very similar app with some compelling additional features. It also lets you choose, on a per-app basis, access to wifi, 3G/4G, and additionally roaming which could be very useful for those who have roaming data charges.
It also allows profiles to be set up so you can easily change configurations without spending time setting all the app permissions if you want, for instance, different configuration for home vs work use.
Like all the other comprehensive solutions it also requires root access.
Following are some apps that claims to be a firewall, mostly using IP-tables or VPN to restrict internet access to apps:
Root access not required:
Root access required:
- Root Firewall
- MsWall Firewall
- Advanced Firewall
- Antivirus and Security
- Firewall Plus
- Firewall Gold
Access not mentioned:
Note: These are those apps which were not covered in answers mentioned at the time of writing this answer. There can be many more in Play Store or on the web.
You can try the Greenify app.
It saves your battery as well as you data. You can suspend the app and the app only runs when you open it.
I am amazed no one has mentioned the Google solution, Datally. No root required. More information on the Google blog: https://blog.google/technology/next-billion-users/meet-datally-new-way-understand-control-and-save-mobile-data/
Or download immediately from the Play Store: https://play.google.com/store/apps/details?id=com.google.android.apps.freighter
Yes, with APK APP :
To block networks for specified apps:
1. Open "Net blocker"
2. Tap app that you would like to block it from accessing the Internet access
3. Check the network types that you'd like to block
4. "Net blocker" app will automatically disable the Internet connection when the blocked app is running in the foreground
5. A new notification icon will tell you which networks are blocked
6. Tap the notification icon to restore the Internet connection, tap again to disable the Internet
or, check the below link :
Well I would personally have a service running where I can get the currently running application like here
Also what you can do is that you can turn the mobile packet data off if the activity is the one which you want to block
like here in this example
except for this method I don't think there is a easy way you can deny internet to a application because it requested for it at the time of download itself.
You can also control which apps may access Internet with LostNet Firewall: https://play.google.com/store/apps/details?id=com.lostnet.fw.free
While your requirements are pretty simple and many apps can satisfy your needs, with LostNet Firewall you can do a little research on the countries your apps connect to and, may be, you will completely block access to certain countries.
Force stopping an app in Android stops it from doing anything, even using the internet, unless you open up the app again. This mainly solves my problem most of the time. Or else restricting background data prevents all the apps from using the internet in the background, aside from some stock Android apps.