Skip to content

Mahmoud85/cordova-plugin-vpn-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 string ACTIVEVPN
  • => errorCallback is called if there was an error determining if a VPN is active and returned params is a string INACTIVEVPN

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

MIT License

Mahmoud Bakhit © 2024


| / | | | | | | . . | __ | |_ _ __ ___ ___ _ _ | | | |/| |/ | '_ \| '_ _ \ / _ | | | |/ ` | | | | | (| | | | | | | | | | () | || | (| | _| |/_,|| ||| || ||_/ _,|_,|


| | | | | |
| |
__ | || |
_ _
| / ` | _| ' | | | |
| || (
| | |
| | | | || |
_| _
,|_|| ||__, |
__/ |
@ Email:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published