I am trying to connect my Android device to localhost ie wampserver using android volley
This is my code:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String url = "http://192.16x.x.xxx/folderName/ClutchTester.php";
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Toast.makeText(getApplicationContext(),response.toString(),Toast.LENGTH_LONG).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(),error.toString(),Toast.LENGTH_LONG).show();
}
});
Volley.newRequestQueue(getApplicationContext()).add(request);
}
}
Toast says AuthFailureError . the IP address I am using here is an IPv4 Address. Does anybody know why I am getting this error and how I can solve this?
Try to assign fixed ip to your pc instead of get automatically
When you are done
Reason : The ip you are using is probably not found by your router since ip is automatically assigned.
Don't forget
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.