From 8b99f833dc1d6695af6dc01e71485c565c7de003 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Mon, 9 Oct 2017 12:30:18 +0300 Subject: [PATCH] Move proxy setting code to startApplication --- OsmAnd/src/net/osmand/plus/OsmandApplication.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index 2c69be0c62..5a832fbd7b 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -146,9 +146,6 @@ public class OsmandApplication extends MultiDexApplication { appCustomization.setup(this); osmandSettings = appCustomization.getOsmandSettings(); appInitializer.initVariables(); - if (osmandSettings.ENABLE_PROXY.get()) { - NetworkUtils.setProxy(osmandSettings.PROXY_HOST.get(), osmandSettings.PROXY_PORT.get()); - } if (appInitializer.isAppVersionChanged() && appInitializer.getPrevAppVersion() < AppInitializer.VERSION_2_3) { osmandSettings.freezeExternalStorageDirectory(); } else if (appInitializer.isFirstTime()) { @@ -364,9 +361,6 @@ public class OsmandApplication extends MultiDexApplication { public void checkApplicationIsBeingInitialized(Activity activity, AppInitializeListener listener) { // start application if it was previously closed startApplication(); - if (NetworkUtils.getProxy() == null && osmandSettings.ENABLE_PROXY.get()) { - NetworkUtils.setProxy(osmandSettings.PROXY_HOST.get(), osmandSettings.PROXY_PORT.get()); - } if(listener != null) { appInitializer.addListener(listener); } @@ -555,6 +549,9 @@ public class OsmandApplication extends MultiDexApplication { if (!(uncaughtExceptionHandler instanceof DefaultExceptionHandler)) { Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler()); } + if (NetworkUtils.getProxy() == null && osmandSettings.ENABLE_PROXY.get()) { + NetworkUtils.setProxy(osmandSettings.PROXY_HOST.get(), osmandSettings.PROXY_PORT.get()); + } appInitializer.startApplication(); }