Android Kitkat (19) and below does not support TLS 1.2

This commit is contained in:
Caesar2011
2019-02-06 23:25:43 +01:00
parent 7b85147d74
commit 40e4612f27

View File

@@ -1,6 +1,7 @@
package de.sebse.fuplanner.services.canteen;
import android.content.Context;
import android.os.Build;
import org.json.JSONArray;
import org.json.JSONException;
@@ -64,6 +65,11 @@ public class CanteenBrowser extends HTTPService {
}
private void upgradeCanteens(final NetworkCallback<Canteens> callback, final NetworkErrorCallback errorCallback) {
// TSL 1.2 not supported (https://github.com/google/volley/issues/77)
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
callback.onResponse(new Canteens());
return;
}
get("https://openmensa.org/api/v2/canteens?near[lat]=52.449743&near[lng]=13.282245&near[dist]=7", null, response -> {
String body = response.getParsed();
if (body == null) {
@@ -125,6 +131,11 @@ public class CanteenBrowser extends HTTPService {
}
private void upgradeCanteen(Canteen canteen, final NetworkCallback<Canteen> callback, final NetworkErrorCallback errorCallback) {
// TSL 1.2 not supported (https://github.com/google/volley/issues/77)
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
callback.onResponse(canteen);
return;
}
get(String.format("https://openmensa.org/api/v2/canteens/%s/days", canteen.getId()), null, response -> {
String body = response.getParsed();
if (body == null) {
@@ -172,6 +183,11 @@ public class CanteenBrowser extends HTTPService {
}
private void upgradeDay(Day day, final NetworkCallback<Day> callback, final NetworkErrorCallback errorCallback) {
// TSL 1.2 not supported (https://github.com/google/volley/issues/77)
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
callback.onResponse(day);
return;
}
get(String.format("https://openmensa.org/api/v2/canteens/%s/days/%s/meals/", day.getCanteenId(), Canteen.calendarToKey(day.getCalendar())), null, response -> {
String body = response.getParsed();
if (body == null) {