61

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?

5

14 Answers 14

33

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:

  • Remove the 'internet' permission using an app like Permissions Denied
  • If your kernel supports IPTables, you can use an app such as AFWall+ to control which apps have access to the internet.
5
  • That's amazing. I spent time searching Google Play and could not find any apps, other than those that required rooting. Yet this app claims to be the only app that can do it without rooting. I'll give it a try. Is it possible in Android to arrange the order in which some apps boot up when the system starts?
    – AndroidDev
    Mar 6, 2013 at 5:54
  • 2
    Unfortunately, you can't change the sequence in which apps start on phone start-up and since the device isn't rooted you can't actually block apps from loading on start-up. The safest bet is to simply disable your mobile data and wifi prior to restarting your device, and then re-enable it once the device has restarted.
    – SimeonJM
    Mar 6, 2013 at 6:01
  • play.google.com/store/apps/… I have created an app, which is easy to handle. Oct 30, 2018 at 10:30
  • What if I want to block internet access from my keyboard? You know, just so it stops sending all my passwords out there. So without root, the only other way is compromising it with another app that can track everything...
    – Dpedrinha
    Dec 25, 2019 at 18:33
  • @Dpedrinha here you might find some useful info: github.com/PhilippC/keepass2android/blob/master/docs/… Mar 29, 2020 at 11:40
26

Without 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 , 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).


Update:

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 NetGuard
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+ 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).

4
  • 4
    Thanks, @IsmaelMiguel – glitch on the keyboard (typing too fast, caught two neighbor keys at once). Be welcome editing out such typos yourself (earning some rep ;) // Temporary root in this case would only work as long as it's active: removing the permission would make most apps crash, so the "preventer" needs to "permanently fake the network-down" to the app. Same applies to most other permissions: apps get fed fake data like "empty calendar/contact list", "IMEI=0123456789", etc. instead of a real permission-removal. Safer this way :)
    – Izzy
    Apr 29, 2015 at 15:26
  • I'm not worried about being safe or not. I cracked the screen of my tablet out of rage because it was too slow. And the ROM where it is installed is protected against re-flashing. I don't even have a recovery menu! (The one with the power button and the volume key). And I'm not worried about apps crashing, as long as nothing else accesses the internet besides VNC. Apr 29, 2015 at 16:16
  • 1
    @IsmaelMiguel OK, that's a different situation. See e.g. Revoke App Permissions Without Root? and also check the questions "linked to it". And remember: Expect crashes – especially force-closes.
    – Izzy
    Apr 29, 2015 at 16:37
  • 1
    Thank you a lot! I would upvote you 100 times just for that! I would love to revoke the right for the bloody apps to start when I turn on the tablet, but it wouldn't have anything to do with this question and your answer. The link you provided would be a great plus on your question, in case the O.P. is as desperate as the other guy. But I will take a look at it. Once again, thank you a lot! Apr 29, 2015 at 16:52
6

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.

6

Droidwall

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.

showing droid wall interface with one app per line and two checkboxes, one for wifi and one for 3G, next to each app

Afwall+

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.

enter image description here

4
  • 5
    droidwall is old. Use AFWall+
    – samsung
    Apr 29, 2015 at 17:15
  • Droidwall was bought by Avast. Avast now offers it in its app here on Play Store. As obvious, it needs root access.
    – Firelord
    Apr 30, 2015 at 5:46
  • @samsung: Could you please write a similar answer about AFWall+? Thanks! Apr 30, 2015 at 9:09
  • @samsung thanks for the info, I've updated my answer with your suggestion.
    – Adam Davis
    Apr 30, 2015 at 10:45
4

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:

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.

2

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.

3
  • 2
    This would only prevent the app accessing the network when it's not running in foreground; as soon as you want to use it, Greenify resumes ("un-hibernates") it, and it will access the network again. OP asked "to prevent some apps from accessing to internet when wi-fi or mobile data is on" – not "when the app is in background". To me, that includes "when the app is in foreground" (i.e. actively used) – where Greenify wouldn't prevent network access. Unless that's a new feature I've missed, that is :)
    – Izzy
    Apr 29, 2015 at 11:10
  • there is no such feature in greenify still :) ... I suggested this app because it will do what the user wants at some extent
    – Dalvik
    Apr 29, 2015 at 11:26
  • 2
    Yepp, I wasn't saying "it's not an answer" (see my answer, where I pointed that out with a few more details – and even linked yours) – just that it's "somehow incomplete". Don't get me wrong: Greenify is a great app – and yes, it's covering at least part of what the user wants. You've got that upvote for a reason :)
    – Izzy
    Apr 29, 2015 at 11:28
2

For CyamogenMod Users

There is a built in Privacy Guard. (Settings -> Privacy)

It can prevent app from using Internet (wifi and/or mobile)

2

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

2
1

Yes, with APK APP :

Net Blocker - Google Play

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 :

Block apps from accessing the Internet on Android device

2
  • 1
    It seems net blocker just turns off or on wi-fi and does nothing else. Apr 29, 2015 at 10:53
  • 1
    That would mean bringing the entire network connection down as soon as that app is running – so no more update-checks (e.g. for new mails) or GCM notifications (WhatsApp etc.) in the background then. But yeah, without root, not much choice …
    – Izzy
    Apr 29, 2015 at 11:08
0

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

https://stackoverflow.com/questions/3644144/how-to-disable-mobile-data-on-android

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.

0

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.

1
  • Please read the documentation regarding self-promotion in the Help Center. Feb 10, 2014 at 10:58
0

To disable mobile data from the carrier :

  1. Make sure the sim card is in the phone and the phone is not in airplane mode , otherwise the option is not shown.
  2. From Settings->Data Usage->Mobile data switch to off

Works for Samsung J3 2016

-1

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.

2
  • The first method is very inconvenient and way too extreme. I want to use a game or an app but don't want it to connect to internet. Clearly, force-stopping isn't the way to go here. The second method won't be restricting my active game or app to access the internet either. Maybe a bit more research on the situation would help you to post a more relevant answer.
    – Firelord
    Jan 12, 2016 at 20:44
  • Most apps have wakeup services programmed to undo exactly that
    – Dpedrinha
    Dec 25, 2019 at 18:29
-2

I use Easy Battery Saver. Choose super power mode and configure the apps that allowed to accessing network.

1
  • 2
    A link to the app would be useful. Could you make it clear whether this app needs root?
    – Dan Hulme
    Aug 27, 2013 at 17:33

You must log in to answer this question.