我有一个带有排行榜的小应用程序,我想用假分数隐藏玩家。我在https://developers.google.com/games/services/management/api/players/hide#request
问题是,我不知道 http 请求和那些东西。那么如何发送 HTTP 请求呢?谷歌的开发者控制台中是否有终端或其他东西,我将命令放入其中?或者我需要做什么才能发送这样的请求?
我有一个带有排行榜的小应用程序,我想用假分数隐藏玩家。我在https://developers.google.com/games/services/management/api/players/hide#request
问题是,我不知道 http 请求和那些东西。那么如何发送 HTTP 请求呢?谷歌的开发者控制台中是否有终端或其他东西,我将命令放入其中?或者我需要做什么才能发送这样的请求?
我建议你使用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);