限制应用程序在 Android 上以编程方式使用 VPN

Restrict applications from using VPN programatically on Android

我已经在我的 Android 设备上创建了一个 VPN 配置文件。现在,我想创建一个 Android 应用程序来管理(限制和允许)哪些应用程序可以访问此 VPN 配置文件。

到目前为止,我已经查看了 Android 的 VPN 服务,它允许我们管理哪些应用程序可以访问 VPN 服务,但我无法将此解决方案如何与已创建的 VPN 相适应个人资料。

您可以找到许多免费的 vpn 或代理服务器。我使用 nord vpn 和他的效率我检查我的 ip 服务是什么。您也可以使用它。免费。 VPN 在您需要访问被阻止的网站或社交媒体(如 Twitter 或 Facebook)时非常重要。我在中国旅行期间使用了 vpn 和 whats my ip 服务。

VpnService API and VPN connections you create in Android's built-in VPN client. When using the VpnService API you'll have to implement a VPN protocol yourself and tunnel data read from the TUN device, which is created via the API, and back again (or use a library that implements a VPN protocol that does this for you), only then can you restrict apps from using the VPN using VpnService.Builder's addDisallowedApplication()方法之间没有关系。

您也可以在应用商店中寻找已经使用此API的VPN应用,并支持排除(或包括)可能使用该VPN的应用。