Vadim Korzun Vadim Korzun - 5 months ago 33
Java Question

how to correctly use search query of Facebook graph API (android)?

I'm trying to run a query to search for locations using search query facebok graf api for android.

If I try to run this query in the Graph API Explorer, I get this result.

But programmatically it is impossible. I try to make so:

new GraphRequest(AccessToken.getCurrentAccessToken(),"/search?q=coffee&type=place&center=37.76,-122.427",null,HttpMethod.GET,new GraphRequest.Callback()
public void onCompleted(GraphResponse response)
Log.v("HelloFacebook", response.toString());

i get nothing (param distance must be number)

if I try without distance i get too nothing, but another message (An access token is required to request this resourse and too)

What could be the problem?


Right syntax for search in Facebook graph API:

GraphRequest request = GraphRequest.newGraphPathRequest(
  new GraphRequest.Callback() {
    public void onCompleted(GraphResponse response) {
      // Insert your code here

Bundle parameters = new Bundle();
parameters.putString("type", "place");
parameters.putString("center", "53,27");
parameters.putString("distance", "30000");