当前位置: 首页>>代码示例>>Java>>正文


Java OrbotHelper.isOrbotRunning方法代码示例

本文整理汇总了Java中info.guardianproject.netcipher.proxy.OrbotHelper.isOrbotRunning方法的典型用法代码示例。如果您正苦于以下问题:Java OrbotHelper.isOrbotRunning方法的具体用法?Java OrbotHelper.isOrbotRunning怎么用?Java OrbotHelper.isOrbotRunning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在info.guardianproject.netcipher.proxy.OrbotHelper的用法示例。


在下文中一共展示了OrbotHelper.isOrbotRunning方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: torEnable

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
public void torEnable() {
    CookieHelper.acceptCookies(webView, false);
    CookieHelper.deleteCookies();
    //Make sure that all cookies are really deleted
    if (!CookieManager.getInstance().hasCookies()) {
        if (!OrbotHelper.isOrbotRunning(mApplicationContext))
            OrbotHelper.requestStartTor(mApplicationContext);
        try {
            WebkitProxy.setProxy(MainActivity.class.getName(), mApplicationContext, null, "localhost", PORT_TOR);
            SharedPreferences.Editor spEdit = sp.edit();
            spEdit.putBoolean(PREF_TOR_ENABLED, true);
            spEdit.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    webView.reload();
}
 
开发者ID:martykan,项目名称:webTube,代码行数:19,代码来源:TorHelper.java

示例2: initializeProxy

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
private void initializeProxy(@NonNull Activity activity) {
    String host;
    int port;

    switch (mPreferences.getProxyChoice()) {
        case Constants.NO_PROXY:
            // We shouldn't be here
            return;
        case Constants.PROXY_ORBOT:
            if (!OrbotHelper.isOrbotRunning(activity)) {
                OrbotHelper.requestStartTor(activity);
            }
            host = "localhost";
            port = 8118;
            break;
        case Constants.PROXY_I2P:
            mI2PProxyInitialized = true;
            if (mI2PHelperBound && !mI2PHelper.isI2PAndroidRunning()) {
                mI2PHelper.requestI2PAndroidStart(activity);
            }
            host = "localhost";
            port = 4444;
            break;
        default:
            host = mPreferences.getProxyHost();
            port = mPreferences.getProxyPort();
            break;
        case Constants.PROXY_MANUAL:
            host = mPreferences.getProxyHost();
            port = mPreferences.getProxyPort();
            break;
    }

    try {
        WebkitProxy.setProxy(BrowserApp.class.getName(), activity.getApplicationContext(), null, host, port);
    } catch (Exception e) {
        Log.d(TAG, "error enabling web proxying", e);
    }

}
 
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:41,代码来源:ProxyUtils.java

示例3: checkTorRunning

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
public static boolean checkTorRunning(Context context, boolean notifyUser) {
    if (Config.values.useProxy
            && Config.values.useTor
            && OrbotHelper.isOrbotInstalled(context)
            && !OrbotHelper.isOrbotRunning(context)) {
        if (!notifyUser) {
            OrbotHelper.requestStartTor(context);
            return true;
        } else return false;
    } else return true;
}
 
开发者ID:vit1-irk,项目名称:idec-mobile,代码行数:12,代码来源:SimpleFunctions.java

示例4: initializeProxy

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
private void initializeProxy(Activity activity) {
    String host;
    int port;

    switch (mPreferences.getProxyChoice()) {
        case Constants.NO_PROXY:
            // We shouldn't be here
            return;

        case Constants.PROXY_ORBOT:
            if (!OrbotHelper.isOrbotRunning(activity))
                OrbotHelper.requestStartTor(activity);
            host = "localhost";
            port = 8118;
            break;

        case Constants.PROXY_I2P:
            mI2PProxyInitialized = true;
            if (mI2PHelperBound && !mI2PHelper.isI2PAndroidRunning()) {
                mI2PHelper.requestI2PAndroidStart(activity);
            }
            host = "localhost";
            port = 4444;
            break;

        default:
            host = mPreferences.getProxyHost();
            port = mPreferences.getProxyPort();
    }

    try {
        WebkitProxy.setProxy(BrowserApp.class.getName(), activity.getApplicationContext(), null, host, port);
    } catch (Exception e) {
        Log.d(Constants.TAG, "error enabling web proxying", e);
    }

}
 
开发者ID:javadtaghia,项目名称:DeeBrowser,代码行数:38,代码来源:ProxyUtils.java

示例5: checkTor

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
public static boolean checkTor(Context mContext) {

        if(OrbotHelper.isOrbotRunning(mContext)) {
            Timber.d("ORBOT RUNNING, USE TOR");
            return true;
        } else {
            Timber.d("ORBOT NOT RUNNING, DON'T USE TOR");
            return false;
        }
    }
 
开发者ID:StoryMaker,项目名称:storypath,代码行数:11,代码来源:LigerDownloadManager.java

示例6: connectToServer

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
public void connectToServer(final Server server) {
    // Check if we're already connected to a server; if so, inform user.
    if(mService != null && mService.isConnected()) {
        AlertDialog.Builder adb = new AlertDialog.Builder(this);
        adb.setMessage(R.string.reconnect_dialog_message);
        adb.setPositiveButton(R.string.connect, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                // Register an observer to reconnect to the new server once disconnected.
                mService.registerObserver(new JumbleObserver() {
                    @Override
                    public void onDisconnected(JumbleException e) {
                        connectToServer(server);
                        mService.unregisterObserver(this);
                    }
                });
                mService.disconnect();
            }
        });
        adb.setNegativeButton(android.R.string.cancel, null);
        adb.show();
        return;
    }

    // Prompt to start Orbot if enabled but not running
    // TODO(acomminos): possibly detect onion address before connecting?
    if (mSettings.isTorEnabled()) {
        if (!OrbotHelper.isOrbotRunning(this)) {
            OrbotHelper.requestShowOrbotStart(this);
            return;
        }
    }

    ServerConnectTask connectTask = new ServerConnectTask(this, mDatabase);
    connectTask.execute(server);
}
 
开发者ID:acomminos,项目名称:Plumble,代码行数:37,代码来源:PlumbleActivity.java

示例7: ensureTorIsRunning

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
private static void ensureTorIsRunning(final Context context) {

		if(!OrbotHelper.isOrbotRunning(context)) {
			if(!OrbotHelper.requestStartTor(context)) {

				final AlertDialog.Builder builder = new AlertDialog.Builder(context);
				builder.setMessage(R.string.error_tor_start_failed);

				AlertDialog dialog = builder.create();
				dialog.show();
			}
		}
	}
 
开发者ID:QuantumBadger,项目名称:RedReader,代码行数:14,代码来源:TorCommon.java

示例8: getAuthorizationUrl

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
public String getAuthorizationUrl()
{
    String path = Environment.getExternalStorageDirectory() + File.separator + "flickr.conf";
    
    Timber.d("getAuthorizationUrl() path: " + path);
    
    File confFile = new File(path);
    FlickrProperties fProps = new FlickrProperties(confFile); 
    f = new Flickr(key,                          // key
                   secret,                       // secret
                   "http://localhost/callback",  // callback
                   "delete",                     // permissions ("delete" permission allows read/write/delete)
                   fProps);                      // properties

    if(OrbotHelper.isOrbotRunning(this))
    {    
        Timber.d("orbot running, setting proxy");
        
        Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(Util.ORBOT_HOST, Util.ORBOT_HTTP_PORT));
        f.setProxy(proxy);
    }
    else
    {
        Timber.d("orbot not running, proxy not set");
    }

    url = f.getAuthorizationUrl(); 
    return url;
}
 
开发者ID:StoryMaker,项目名称:SecureShareLib,代码行数:30,代码来源:FlickrLoginActivity.java

示例9: torCheck

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
public static boolean torCheck(boolean useTor, Context mContext) {

        if(useTor && OrbotHelper.isOrbotRunning(mContext))
        {    
            Timber.d("use tor");
            return true;
        }
        else
        {            
            Timber.d("don't use tor");
            return false;
        }
    }
 
开发者ID:StoryMaker,项目名称:SecureShareLib,代码行数:14,代码来源:SiteController.java

示例10: onSharedPreferenceChanged

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
                                      String key) {
    // Никогда не запускать здесь sharedPreferences.edit(), иначе будет
    // цикл с бесконечной рекурсией!

    Activity mContext = getActivity();

    switch (key) {
        case "application_theme":
            Config.select_gui_theme();
            Intent intent = mContext.getIntent();
            mContext.finish();
            startActivity(intent);
            break;
        case "use_proxy":
            Network.proxy = null;
            break;
        case "proxy_address":
            Network.proxy = null;
            break;
        case "use_tor":
            boolean useTor = sharedPreferences.getBoolean(key, Config.default_values.useTor);

            if (useTor) {
                Context context = mContext.getApplicationContext();
                if (!OrbotHelper.isOrbotInstalled(context)) {
                    startActivity(OrbotHelper.getOrbotInstallIntent(context));
                } else if (!OrbotHelper.isOrbotRunning(context)) {
                    startActivity(OrbotHelper.getShowOrbotStartIntent());
                }
            }
            break;
        case "notifications_enabled":
            mContext.startService(new Intent(mContext, AlarmService.class));
            break;
        case "notify_fire_duration":
            mContext.startService(new Intent(mContext, AlarmService.class));
            break;
        case "notifications_vibrate":
            mContext.startService(new Intent(mContext, AlarmService.class));
            break;
    }
}
 
开发者ID:vit1-irk,项目名称:idec-mobile,代码行数:45,代码来源:SettingsFragment.java

示例11: isOrbotRunning

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
public static boolean isOrbotRunning(Context mContext) {
    return OrbotHelper.isOrbotRunning(mContext);
}
 
开发者ID:StoryMaker,项目名称:SecureShareLib,代码行数:4,代码来源:Util.java


注:本文中的info.guardianproject.netcipher.proxy.OrbotHelper.isOrbotRunning方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。