如何以编程方式连接到L2tp vpn服务器?

时间:2016-04-27 09:27:38

标签: java android mobile vpn l2tp

我有一个L2TP/IPSEC VPN服务器,现在我想在Android4.0+上以编程方式连接到此服务器。 我查看了ToyVpnLocalVpnOpenVpnSimpleVpn,但这些示例在我的计算机上无效。 似乎绑定服务存在一些问题。 我对ACTION_VPN_SERVICE没有深入了解,这个函数返回false。 我该如何解决这个问题。 帮帮我。谢谢!

public boolean bindVpnService(ServiceConnection c) {
    if (!mContext.bindService(new Intent(ACTION_VPN_SERVICE), c, 0)) {
        Log.w(TAG, "failed to connect to VPN service");
        return false;
    } else {
        Log.d(TAG, "succeeded to connect to VPN service");
        return true;
    }
}

0 个答案:

没有答案
相关问题