VivekRajendran
VivekRajendran

Reputation: 736

Set app level proxy

I'm trying to create some sort of SDK that we intercept each request from my app regardless of which HTTP client it's using (be it native HttpURLConnection, OkHttp, Retrofit etc.). And including traffic from third-party libraries like Firebase Analytics etc.

I need to intercept and check few parameters then decide whether to allow or block current request.

I don't want to use any Custom VPN as it has some side effects like showing system level Notification and all traffic from the user device.

Is it possible to capture all requests by setting app level proxy? If possible, How to achieve it in code?

Upvotes: 7

Views: 3603

Answers (2)

Denis Loh
Denis Loh

Reputation: 2224

You could give a try to implement a custom VPN with https://developer.android.com/reference/android/net/VpnService. With this you should be able to control which traffic is allowed to access the internet and which not. As you wrote, that you'll create an SDK, the implementors should know the side effects of VPNs in apps (ongoing system notification, every traffic is routet through that VPN, etc.)

Upvotes: 2

Milan Pansuriya
Milan Pansuriya

Reputation: 2559

You can use Retrofit The retrofit will save your development time, And also you can keep your code in developer friendly. Retrofit has given almost all the API's to make a server call and to receive a response. internally they also use GSON to do the parsing. you can go through this link you will get more info Alos you can see the difference with other libs

Upvotes: 2

Related Questions