我如何在Android Studio中使用get方法volley

时间:2019-10-31 18:47:19

标签: java android android-volley

我的代码中的GET方法有问题,url1不起作用,但在Postman中却可以。

邮递员GET方法的网址有效

https://kokis.com/app/appLoc.php?location=36.11111,54.22222&licence=zafar&vaziat=vorood

private void Get_Exit_user(){

  final String url1 = "https://kokis.com/app/appLoc.php?location="+"36.11111"+","+"54.22222"+"&licence="+"zafar"+"&vaziat="+"khorooj";


       // prepare the Request
       JsonObjectRequest getRequest = new JsonObjectRequest(Request.Method.GET, url1,
               new Response.Listener<JSONObject>()
               {
                   @Override
                   public void onResponse(JSONObject response) {
                       // display response
                       Log.d("Response", response.toString());
                   }
               },
               new Response.ErrorListener()
               {
                   @Override
                   public void onErrorResponse(VolleyError error) {

                   }
               }
       );

       // add it to the RequestQueue
       queue.add(getRequest);        
   }

0 个答案:

没有答案