shadowsocks / shadowsocks-android

A shadowsocks client for Android
Other
34.86k stars 11.58k forks source link

Try to make "Restrict background data" work with Shadowsocks #996

Closed m13253 closed 7 years ago

m13253 commented 7 years ago

In Settings → Data → Top-right menu, we can apply background data restrictions, which will be useful if you accidentally run out of your monthly data plan.

However this option does not work with Shadowsocks because the VPN always runs in the background, causing all other apps to be offline.

I am wondering if we can manage to make it work. I am not sure if there are any API to bypass the restriction for a single app. But I think it would be possible if we implement a similar feature in Shadowsocks. Here is my idea:

First the user turn on a switch in Shadowsocks app. Whenever an activity switch happens, allow all network requests from the app of the new activity, then (optionally after some timeout), drop all network requests from the old app, if the old app is not opened during the timeout.

I wonder if you are interested in this feature. I am happy to discuss about it.

Anyway, thanks for this piece of wonderful software!

Mygod commented 7 years ago

Shadowsocks works fine with system data saver. Tested on cm14.1.