diff --git a/OpenVehicleApp/AndroidManifest.xml b/OpenVehicleApp/AndroidManifest.xml index e514e2c9..bbf47354 100644 --- a/OpenVehicleApp/AndroidManifest.xml +++ b/OpenVehicleApp/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="20150201" + android:versionName="3.3.2"> url=" + url); - // start fetcher: - new GetMapDetails(MainActivity.this, url, this).execute(); + // cancel old fetcher task: + if (getMapDetails != null) { + getMapDetails.cancel(true); + } + + // create new fetcher task: + getMapDetails = new GetMapDetails(MainActivity.this, url, this); + + // After Android 3.0, the default behavior of AsyncTask is execute in a single + // thread using SERIAL_EXECUTOR. This means the thread will no longer run while + // the App is in the foreground... + // Solution source: + // http://stackoverflow.com/questions/13080367/android-async-task-behavior-in-2-3-3-and-4-0-os + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { + getMapDetails.execute(); + } else { + getMapDetails.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } }