cordova-plugin-vpn-detection
v0.0.4
Published
Developed for Ionic legacy app to detect if a VPN is open on the mobile device
Downloads
7
Maintainers
Readme
Cordova VPN Dectection
This Plugin works for both Android and iOS platform, and it is intended to be used for legacy Ionic 2,3 and 4 apps to detect active VPN on mobile devices, so it is tested on both platforms.
- Node version 10.x
- cordova ">=3.0.0"
Install
- Run
npm i cordova-plugin-vpn-detection
- Run
ionic cordova plugin add cordova-plugin-vpn-detection
Usage
Is VPN active on device
window.vpndetection.detectActiveVPN(successCallback, errorCallback)
=> successCallback
is called with true if VPN is active on device and returned param is a stringACTIVEVPN
=> errorCallback
is called if there was an error determining if a VPN is active and returned params is a stringINACTIVEVPN
Example
let successCallback = function (result) {
let VPNIsActive = result == "ACTIVEVPN"
};
let errorCallback = function (failure) {
console.log(failure)
};
[!TIP] I would recommend to use the plugin by implementing the check in two different cases as below:
Make the check when app is initialized
Make the check when app status change from background to foreground, so that vpn check will be done even if user activated the VPN after launching the app.
Platform Support
iOS and Android.
License
Mahmoud Bakhit © 2024
| / | | | | |
| . . | __ | |_ _ __ ___ ___ _ _ | |
| |/| |/ | '_ \| '_
_ \ / _ | | | |/ ` |
| | | | (| | | | | | | | | | () | || | (| |
_| |/_,|| ||| || ||_/ _,|_,|
| | | | | |
| | __ | || | _ _
| / ` | | ' | | | |
| || (| | || | | | || |
_| _,|_|| ||_, |
__/ |
@ Email: