1

I have a little app with a leaderboard and i want to hide players with fake scores. I read about it at https://developers.google.com/games/services/management/api/players/hide#request

The Problem is, that i have no idea from http Requests and that things. So how do i send a HTTP Request? Is there a Terminal or something in the Developer Console from Google, where i put my command in? Or what do i need to do, to send an Request like this?

Phil
  • 304
  • 1
  • 5
  • 12

1 Answers1

1

I recommend that you use Volley

Add Volley to your project through Gradle

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

Add the android.permission.INTERNET permission to your app's manifest.

The code is taken from 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);
William Ku
  • 798
  • 5
  • 17
  • It might be a very good answer, but i dont get it. To my Problem: Where i put the POST https://www.googleapis.com/games/v1management/applications/applicationId/players/hidden/playerId in? Do i use this in code or from outside..? – Phil May 09 '16 at 13:24
  • Hi, you may put the the url in the String url (at the comment //set your web call here) and then use Request.Method.POST in the stringRequest. In other words, you can form separate StringRequest for individual GET and POST requests. You can also add in other required parameters accordingly. – William Ku May 10 '16 at 02:54