Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        public static void onVpnServiceCreated(FirewallVpnService vpnService)
        {
            sVpnService = vpnService;

            if (context == null)
            {
                context = vpnService.ApplicationContext;
            }
        }
Esempio n. 3
0
 public static void onVpnServiceDestroy()
 {
     sVpnService = null;
 }