0

I need data of places from Fourquare. I tried to use Venue. But don't have response.

      try {
         HttpClient client = new DefaultHttpClient();  
         String getURL = "https://api.foursquare.com/v2/venues/4cbd52efd78f46881cf1cc73";     
        HttpGet get = new HttpGet(getURL);
        HttpResponse responseGet = client.execute(get);  
        HttpEntity resEntityGet = responseGet.getEntity();  
        if (resEntityGet != null) {  
            // do something with the response
            String response = EntityUtils.toString(resEntityGet);
            Log.i("GET RESPONSE", response);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

How to use this?

Please help.

Thanks.

MaximumBua
  • 61
  • 1
  • 2
  • 4

2 Answers2

0

You should query your Latitude and Longitude for getting nearest Location. It makes sense.

Change you URL to below to get nearest place :

String getURL = "https://api.foursquare.com/v2/venues/search?ll="Your Latitude","Longitude"&intent=checkin&limit=50&oauth_token=MVVYZJAO0V4UNTA3YFHGI5YO2YEXIM3TTLW1GO2YZNOZZXER";

ll - Latitude & Longitude

oauth_token - Your Valid Token

Limit - As you like nearer to you

Venky
  • 11,049
  • 5
  • 49
  • 66
0

Almost every query to the Foursquare API must include a valid OAuth token. In some cases, such as yours, you may use the Client ID and Client Secret that Foursquare gave you after registering your app (but it's a bad idea if you want to distribute your app). After appending the token to the URL, you'll get the JSON answer you're expecting.

You can find an example on getting a OAuth token on Android in this GitHub repository

PotterSys
  • 21
  • 1
  • 1
  • 4