android-vpn | SSTP VPN client for Android | VPN library
kandi X-RAY | android-vpn Summary
kandi X-RAY | android-vpn Summary
This is an incomplete attempt at creating an SSTP VPN client for android.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Connect button
- Invoked when an activity is received
- Get a new VpnApp from the context
- Called when the builder is created
- Build and inject the object graph
- Convenience method to add a VpnModule to the list
- Start the service
- Set up the activity
- Destroys the current thread
- Injects the object graph into the object graph
- Provide the shared preferences
android-vpn Key Features
android-vpn Examples and Code Snippets
Community Discussions
Trending Discussions on android-vpn
QUESTION
I'm trying to write a VPN application for android, and no matter what I do it seems that the "Always On" setting for my application is grayed out.
I cannot find any documentation anywhere in the android docs that states WHY a VpnService might not be allowed to use the "Always On" feature.
Just to make sure I'm clear, my VpnService works just fine if i manually enable it. I'm able to connect, use it, etc without any issues. I'm just confused as to why in the Android settings it's showing as "not supported for this device" under the "Always-On" toggle for my Vpn Service.
Note: I am using a custom protocol, and on some forum somewhere I did see once that "Google doesn't allow Always-On for VPNs that don't use protocols that have been whitelisted by google", however no where have I found documentation to support this claim, so I'm doubtful that it is the cause.
What I have found from reading the Android Documentation:
If you explicitly supply the SERVICE_META_DATA_SUPPORTS_ALWAYS_ON flag to the
definition in your Android Manafest with a value of
false
it will tell the system that your application does not support the Always On feature. However, if you leave it out, it defaults totrue
. So there should be no need to supply this.According to the Android Souce in AppManagementFragment.java#updateRestrictedViews, it uses a function
mConnectivityManager.isAlwaysOnVpnPackageSupportedForUser(mUserId, mPackageName)
, however I'm having difficulty following the logic of this function. When looking at ConnectivityManager.java#isAlwaysOnVpnPackageSupportedForUser, it seems to end up in ConnectivityService.java#isAlwaysOnVpnPackageSupported and ultimately points to Vpn.java#isAlwaysOnPackageSupported which can result in your VPN being considered to NOT support always on if one of the following is met:- The package name passed to the function is null.
- The system is unable to locate the package using
PackageManager. getApplicationInfoAsUser()
. - The target for the application is less than
VERSION_CODES.N
- The package does not contain any Vpn Services in its
AndroidManifest.xml
. - The package defines ANY VpnServices with the
SERVICE_META_DATA_SUPPORTS_ALWAYS_ON
meta data set tofalse
.
Note: My application targets API 29.
And that's about it.
Since my application meets all of the requirements stated in Vpn.java#isAlwaysOnPackageSupported
, i'm left very confused as to why it will not work.
I've created an android studio project that demonstrates this happening on my Samsung Galaxy S10. You can find it here on github.
My code for reference:
My service is configured as is documented in the Android Documentation.
...ANSWER
Answered 2019-Aug-19 at 16:28I've found the problem.
In my AndroidManifest.xml
when I declared the intent-filters for my service I had a typo.
QUESTION
I'm writing a VPN application and the socket used for the VPN Connection is handled in my native C code, not in java. How do I use VpnService.protect()
on that socket? I noticed that it has a VpnService.protect(int)
overload, could I return the int that socket
returns from the native code to Java and protect it that way?
Example
...ANSWER
Answered 2017-Jun-14 at 16:41I simply wanted verification that my processes was valid, after completing more testing I've verified that it works.
Example
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install android-vpn
You can use android-vpn like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the android-vpn component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page