0

I upload the sdk version from 27 to 28 and the app is not working properly.

I debugged the app and the problem is Android Studio does not execute this and jumps to the return.

What I do here is connect to an http address and retrieve it's data to a list.

 JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(ConfigRed.INF_USERS_URL,
            response -> {

                //Calling method parseData to parse the json response
                parseData(response);
            },
            error -> {
         //       Toast.makeText(ActividadPrincipal.this, "No se puede descargar usuarios, Obteniendo usuarios locales", Toast.LENGTH_LONG).show();

                DatabaseHelper db;
                db = new DatabaseHelper(getApplicationContext());
                listUsuarios = db.getMuestreadoresConMuestrasCargadas();

                if (listUsuarios.size() == 0) {
                    Toast.makeText(ActividadPrincipal.this, "No hay registros previos de usuarios. Conectate al laboratorio", Toast.LENGTH_LONG).show();
                    no_internet.setVisibility(View.VISIBLE);
                } else {
                    adapter.setUsuarios(listUsuarios);
                    adapter.notifyDataSetChanged();
                }

                db.closeDB();
            });

    //Returning the request
    return jsonArrayRequest;

I tried this solution but i still retrieving an empty list

Volley Not making request on latest version of Android

I think is because I'm trying to access an http site despite https but I don't know what to do because with the sdk 27 the app runs with no problems but I need using sdk because of google play politics.

Can you help me, please?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Adriiboom
  • 85
  • 13

2 Answers2

1

Add this into your manifest in Application tag. then it will work smoothly.

android:usesCleartextTraffic="true"

theShaybi
  • 81
  • 6
0

You can found the solution in this topic

How to allow all Network connection types HTTP and HTTPS in Android (9) Pie?

The problem was because the use of http, which is by default blocked by Android 9

Thanks

Adriiboom
  • 85
  • 13