I have a private app for work installed on a phone running Android 8 and a tablet running Android 8.1 and it's working fine on both but when I installed it on my new phone running Android 10, it gives me an JSON error. The rest of the app works fine but it's showing a JSONObject as null. Is this just a setting or has something changed with Android 10?
@Override
protected Void doInBackground(Void... arg0) {
HttpJsonParser httpJsonParser = new HttpJsonParser();
Map<String, String> httpParams = new HashMap<>();
JSONObject jsonObject = httpJsonParser.makeHttpRequest(GET_VERSION_URL, "GET", httpParams);
if (jsonObject != null) { // <- Returns fine on Android 8.1 but not Android 10
try {
...
} catch (final JSONException e) {
...
}
} else {
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(MainActivity.this,"Error.", Toast.LENGTH_LONG).show(); // <-Goes to this everytime
}
});
}
return null;
}