public static void changeVpnRunningStatus(Context context, bool isStart) { if (context == null) { return; } if (isStart) { var intent = FirewallVpnService.prepare(context); if (intent == null) { startVpnService(context); } else { if (context is Activity) { (context as Activity).StartActivityForResult(intent, START_VPN_SERVICE_REQUEST_CODE); } } } else if (sVpnService != null) { bool stopStatus = false; sVpnService.setVpnRunningStatus(stopStatus); } }
public static void onVpnServiceCreated(FirewallVpnService vpnService) { sVpnService = vpnService; if (context == null) { context = vpnService.ApplicationContext; } }
public static void onVpnServiceDestroy() { sVpnService = null; }