Android Developer Console 如何发送 HTTP 请求?

Android Developer Console How to send a HTTP Request?

我有一个带有排行榜的小应用程序,我想隐藏得分为假的玩家。我在 https://developers.google.com/games/services/management/api/players/hide#request

上读到了它

问题是,我不知道 http 请求之类的东西。 那么我该如何发送 HTTP 请求呢? Google 的开发者控制台中是否有一个终端或其他东西,我把我的命令放在那里? 或者我需要做什么才能发送这样的请求?

我推荐你使用Volley

通过 Gradle 将 Volley 添加到您的项目

compile 'com.android.volley:volley:1.0.0'

将 android.permission.INTERNET 权限添加到您应用的清单中。

代码取自1

 // Instantiate the RequestQueue.
 RequestQueue queue = Volley.newRequestQueue(this);
 String url ="http://www.google.com"; //set your web call here

 // Request a string response from the provided URL.
 StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
        new Response.Listener<String>() {
    @Override
    public void onResponse(String response) {
       //handle success 
    }
       }, new Response.ErrorListener() {
    @Override
    public void onErrorResponse(VolleyError error) {
       //handle error
    }
});

// Add the request to the RequestQueue.
queue.add(stringRequest);