如何从源代码打开Android VPN隧道?
我已经实现了一个 Android 应用程序,它通过 VPN 隧道连接到其应用程序服务器。没关系。 但是我希望应用程序本身打开 Android VPN 服务,而不是我手动打开 Android 上的 VPN。 是否可以从java源代码中打开它,例如
// TO DO
if (something) {
VPN ON
}
I have implemented an Android application which connects to its application server via a VPN tunnel. Thats fine.
However I want that the application turn on the Android VPN service itself ,rather than I am turning on the VPN on Android manually.
Is it possible to turn on this from java source code, like
// TO DO
if (something) {
VPN ON
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
目前还不可能这样做。 Android 4.0 中的最新类的事件,用户操作是创建 VPN 连接所需的。能够以编程方式建立 VPN 连接(例如,在用户不注意的情况下)被认为是一个安全问题。
Currently it's not possible to do that. Event with the latest classes in Android 4.0, User action is required to create a VPN connection. It's considered a security issue to be able progrmmatically to establish vpn connection (e.g. without the user to notice).
不可能从 Java 源代码关闭 VPN,除非设备已 root,然后就会出现一些黑客攻击。 (所以有人告诉我,作为一家大型软件公司的 Android 开发人员)这几乎是可能做到的,但需要用本机代码编写一些东西。目前有一些公司正在尝试在 SDK 中做到这一点。 Authentec 就是其中之一,但即使在 SDK 中,也无法关闭 VPN 连接。我来这里是想看看是否有人以前做过这个,但我知道通过 Java 代码这是不可能的,它必须用本机代码(对于像我这样的傻瓜来说,用 C 语言)
It is not possible to turn off the VPN from Java source code, unless the device is rooted, then there some hacks around. (so I have been told being an Android developer for a major software company) It is almost possible to do but it will take writing something in Native Code. There are some companies that are currently attempting to do this in an SDK. Authentec is one, but even in there SDK it is not possible to shut off the VPN connection yet. I came here looking to see if anyone has done this before but I know it is not possible through Java code, it will have to be in Native Code ( C for simpletons like myself)