2

I'm trying to create some sort of SDK that we intercept each request from my app regardless which http client it's using (native HttpClient, OkHttp, Retrofit etc.).

For example http://api.uber.com --> https://proxy.startup.com?app_id=32468496&origin_url=http%3A%2F%2Fapi.uber.com with all headers and original body.

It could be great if someone can point me to classes are available to do it on Android for this :)

Thanks a lot:)

Yonatan Levin
  • 342
  • 5
  • 17

1 Answers1

0

You could try having a look at the source code of ProxyDroid (an app which sets global proxy in Android, as we do in Linux). This is because phones do not support proxy settings in general.

However, the app requires root access, the source code available over the net could be a great utility for learning.

Here's the GitHub repository : https://github.com/madeye/proxydroid

Also, some Googling on "vpn for android source code might help you"

I found out this answer that might also be helpful to you (to some extent): Android: Sample Code to use own VPN connection in Android 4.0 using VPNService API

Community
  • 1
  • 1
Himanshu Shekhar
  • 318
  • 9
  • 15
  • Yeah. I familiar with the ProxyDroid, however, it's not helping me, since it should be running on stock non-rooted devices. – Yonatan Levin Nov 28 '15 at 12:52