I am trying to connect to django rest framework server from android studio on my local machine using volley . I tried running server with 0.0.0.0:8000 on command line and have added ALLOWED_HOST=[*] in settings.py.
Error message in android studio
com.android.volley.NoConnectionError: java.net.ConnectException: Failed to connect to /0.0.0.0:8000
Below is the android client code
P.S:- All the import libraries are included.
String URL= "http://0.0.0.0:8000/api/userdata/";
RequestQueue requestQueue = Volley.newRequestQueue(this);
JsonObjectRequest objectRequest = new JsonObjectRequest(
Request.Method.GET,
URL,
null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.e("Response:",response.toString());
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("Response:",error.toString());
}
}
);