OpenConnect VpnService for Android - android

As I know there no API to support PPTP or L2TP connections inside android, so I switched to using openconnect (ocserv).
Is there any VpnService or API to connect to ocserv using Android?
I tried the sample app (ics-openconnect) but the source code is deprecated and complicated to integrate.
Please don't suggest to switch using OpenVPN ;))

Related

Create L2TP/IPSec client android

I need to create a L2TP/IPSec client application android. I read the android VPN documentation. It states some legacy API for that. But I could not find such one. Also provided example app for VPN client does not work since it was built for a very old version. Android has built-in support on this VPN protocol. This answer says no official API. However, I have seen applications which support IPsec directly. how to call it in VpnService class as stated in the official documentation. Also if I need to add custom VPN protocol how to run and get those interfaces from java code?

Connecting to VPN server in Android

I have been working on developing an android client for connecting to a VPN server. I have these concepts for now
Android version 14+ provide an API named VpnService.
You have to implement your own protocols even common protocols like
PPTP,L2TP, IKEV2 etc.
Now I am supposed to connect VPN service via ikev2 protocol. Where i can find the
Manual implementation of ikev2 protocol.
How can I integrate it in android studio.
I have gone through many
blogs and github codes but none of them seems to solve my issue. Thanx!

Is it possible to build a native android-to-android video chat app using webrtc?

I see a lot of tutorials in the Internet teaching about android to browser or browser to browser webrtc application. Is it possible to build a native android-to-android video chat app using webrtc?
Well, for establishing a connection between the devices before the call via peer-to-peer WebRTC solution you need STUN/TURN/ICE servers.
They establish the route for communication between the devices.
Once the route is established the devices communicate directly without participation of a server for passing the media streams.
To make it easier for you, you can look at or try some existing solutions, like ConnectyCube.
They have peer-to-peer WebRTC solution for Android already implemented.
So, maybe there is not need to reinvent the wheel.
There is an official Android sample project AppRTCMobile provided here - https://webrtc.org/native-code/android/. However, the build process is tedious and the total download size exceeds 20 GB. The recommended way is to use the following dependency in your project.
implementation 'org.webrtc:google-webrtc:1.0.+'
However, for video chat functionality you will need to refer AppRTCMobile source code. There is a clone of this project on GitHub updated for Oreo and ready to import in Android Studio. Check out this link.
WebRTC uses ICE protocol for creating connection between two peers. It uses DTLS-SRTP for creating secure data exchange between peers.
Now both ICE protocol and DTLS-SRTP are protocols that can be implemented on any devices no matter what platform. You implement or use existing implementation of
ICE and DTLS-SRTP protocol on your android apps and communicate with each other.
When you read tutorials about implementation of WebRTC for communication between android app and browser, there the android app has the implementation of both ICE and DTLS-SRTP. So this android app can communicate with other android app having similar implementation.
in addition to #tahlil great answer, you can also use a number of open source SDKs out there that already took the burden on bundling the WebRTC libraries and offering simple APIs for you to integrate Real Time Communications in your native app. One example of such SDK is the RestComm Android SDK
See https://github.com/Mobicents/restcomm-android-sdk and http://www.telestax.com/restcomm-client-android-sdk-beta-2-is-out/

Does Android 4.0.3 SIP API support NAT?

I am working with Android 4.0.3 SIP Api and was able to make sip call between 2 users on same network. But it is not working if one of the user is behind NAT/Firewall.
Does Android SIP api support the NAT? if no, is there any workaround for it.
If I find my public IP using some other STUN client, Can I provide this to Android SIP api in SipManager or SipProfile class orin any other class? It seems there is no direct way to do it but any workaroound for it?
If NAT is not supported currently, Is there any expectation to have this support in coming Android releases?
Don't use the sip library provided by Android. Use a third party one or write your own. The one comes with Android is very limited and not supported on every device.

How to configure VPN programmatically on Android?

I need to implement an Android app that would allow the user to configure a VPN connection without having to access the native menu of the Android device. With this I have two problems:
in Android 4.0 + (api level 14 and above) I have found there is a new component called VpnService which provides a hook for creating a virtual network interface, configuring it and intercepting / forwarding pachets from it to a VPN server, but there are no built in vpn protocols like PPTP or IPSec, there is just the possibility of implementing them. My question is is there any ready made solution for PPTP and IPSec to work with VpnService?
In earlier versions of Android, from what I have found so far, it seems the only way to use VPN is to access and configure the built in vpn solution of the device by wrapping (using reflection) some hidden apis in android but this is a cumbersome solution since the device needs to be rooted, also the hidden api implementations may differ from device to device, and from OS version to OS version. Is there a better way to programmatically configure the built in VPN of the underlying linux OS?
1) I don't know of any open-source PPTP or IPSec implementations for the Android 4.x ICS VpnService. VpnService is designed for creating custom-protocol VPN applications (which could in theory be pptp or IPSec). The only open-source implementation I have found that leverages this new API is one for OpenVPN:
https://github.com/schwabe/ics-openvpn
This provides one potential VPN solution that you are fully in control of (the server is open-source also), but it is not PPTP or IPSec. If you understand the PPTP protocol, it should be possible to use this as a model to implement such a VPN client.
2) Yes, it is true that in earlier versions, the only way is through private APIs. In fact, even if you want to do it in later versions using the built in VPN support (i.e. built in PPTP or IPSec support), you have to leverage these hidden APIs. It maybe be possible to do it at a lower-level using the underlying linux kernel, but this would require rooting the OS and circumventing the Android application paradigm. This is not necessarily a better alternative to using private APIs.
For some info on howto configure VPN using those APIs:
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/android/net/vpn/PptpProfile.java
(example of a PPTP profile object, needed to pass into the API)
How to programmatically create a new VPN interface with Android 4.0? (Explains how to store this new VPN profile on the system)
I am not sure how consistent and reliable these APIs will be. I would expect them to work on most Android devices as vendors are unlikely to re-implement the basic VPN implementations, although they may have added their own. They also may have altered the APIs necessary to enable such profiles, or have extended their capabilities.

Categories

Resources