本文整理汇总了Java中info.guardianproject.netcipher.proxy.OrbotHelper.requestStartTor方法的典型用法代码示例。如果您正苦于以下问题:Java OrbotHelper.requestStartTor方法的具体用法?Java OrbotHelper.requestStartTor怎么用?Java OrbotHelper.requestStartTor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类info.guardianproject.netcipher.proxy.OrbotHelper
的用法示例。
在下文中一共展示了OrbotHelper.requestStartTor方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: checkRemoteAccessOnion
import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
private void checkRemoteAccessOnion() {
if (OrbotHelper.isOrbotInstalled(mActivity)) {
OrbotHelper.requestStartTor(mActivity);
if (preferences.getRemoteAccessOnion() != null && TextUtils.isEmpty(preferences.getRemoteAccessOnion().trim())) {
OrbotHelper.requestHiddenServiceOnPort(mActivity, WebServer.LOCAL_PORT);
}
} else {
Toast.makeText(mActivity, R.string.remote_access_onion_error, Toast.LENGTH_LONG).show();
}
}
示例3: 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);
}
}
示例4: 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;
}
示例5: 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);
}
}
示例6: onCreate
import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_use_tor);
registerReceiver(torStatusReceiver, new IntentFilter(OrbotHelper.ACTION_STATUS));
if (!OrbotHelper.requestStartTor(this)) {
// Orbot needs to be installed, so ignore this request
Toast.makeText(this, R.string.you_must_have_orbot, Toast.LENGTH_LONG).show();
finish();
}
isReceiverRegistered = true;
}
示例7: initOnionSite
import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
private void initOnionSite ()
{
if (OrbotHelper.isOrbotInstalled(this))
{
OrbotHelper.requestStartTor(this);
if (mOnionHost == null)
OrbotHelper.requestHiddenServiceOnPort(this, mLocalPort);
}
}
示例8: 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();
}
}
}
示例9: checkStartTor
import info.guardianproject.netcipher.proxy.OrbotHelper; //导入方法依赖的package包/类
public static void checkStartTor(Context context) {
if (useTor) {
OrbotHelper.requestStartTor(context);
}
}