1

How to redirect entire phone traffic (including all apps) to a proxy (with out rooting the phone)

We are developing a parental control app for Android, in that we have requirement to capture all out going traffic from Android phone for categorization. Is there a way to achieve this in Android with out rooting the phone.

Thanks, Gopi.

Gopi
  • 95
  • 1
  • 2
  • 5

2 Answers2

1

By design proxy isn't to be set system-wide, it's to be used on per-connection basis by every app individually. However it's possible to enforce the proxy on whole traffic e.g. by modifying routing table or NAT rules at OSI Layer 2 or 3; either by rooting the phone (which you don't want to) or making use of VPN (as answered by Stephen Schrauger). However you can't redirect all TCP/UDP traffic to a proxy server, there are limitations. For details see Why proxy set on Android does not work when used as hotspot?

Irfan Latif
  • 20,353
  • 3
  • 70
  • 213
1

It sounds like you are describing a VPN (virtual private network). A VPN directs all traffic (whether http or other tcp/ip protocols) through a specific server, usually with the intent to encrypt traffic between the device and the VPN server.

However, encryption isn't necessary, and a VPN would have full control over routing, which means you could customize a VPN server to block specific requests. Or you could redirect requests to unsafe/undesirable websites to a 'block' page of your choosing.

Almost all android devices have VPN capabilities built-in. You should look into that technology. In order to force the user to go through the VPN, you will need an app that can be set as a device admin (a built-in, almost-root privilege that prevents the app from being removed) that would also set the VPN to be always on.

See this Android.SE question and answer for more details.

Stephen S
  • 5,407
  • 6
  • 45
  • 59
  • Thanks Stephen for your valuable answer. Is there any other possible solution than VPN? Since Android 4.0 they included an API called VpnService, through this I can directs all traffic but I see some challenges in that approach. Below are the challenges I see, - User action is required to create a VPN connection.
    • A system-managed notification (in notification bar) is shown during the lifetime of a VPN connection.
    • A system-managed dialog gives the information of the current VPN connection. It also provides a button to disconnect.
    – Gopi Nov 08 '13 at 09:11
  • How can we overcome above mentioned challenges?Any body have any idea on this please help me. We are doing this for an ISP not for individual users.Thanks in advance. Thanks,Gopi. – Gopi Nov 11 '13 at 08:33