Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Android Facebook SDK - Get nearby places

Options
  • 08-12-2015 7:25pm
    #1
    Registered Users Posts: 7,863 ✭✭✭


    Hi guys,

    I wonder if someone can help me. Sorry if this is a bit long winded for a (hopefully) quick fix.

    I've an app that uses Google Maps. The places on the map get populated from data retrieved from my own server, which has coords, name, address, phone etc.
    A feature of the app is to allow the user to add places, and give them a description, list facilities etc.
    On this "Add Places" screen, the user inputs the above details as much as possible. However, nobody knows the GPS coordinates off by heart, so I'm hoping to get them programatically. I'm familiar with the Facebook apps check-in feature, which displays a list of places nearby. I'm hoping to use similar functionality so the user can click a "Search" button and display a screen similar to the check-in screen. Once they select a nearby place, it'll then populate the text fields in the app and allow them to submit that place, along with extra info relevant to the app.

    I've used the Google Places API already and its good. However, there's a previous screen in the app that allows Facebook and Google login. If they choose Google login, then I'll use the Google Places API. However, if they use Facebook login, then I'm hoping to use the FB Graph API in a similar fashion.

    The Google Places stuff is actually done already, so now I'm onto the Facebook part. From my research, I've to use the Graph API. Specifically this:
    https://developers.facebook.com/docs/graph-api/reference/location/

    So on that link, the sample Android code is as follows:
    /* make the API call */
    new GraphRequest(
        AccessToken.getCurrentAccessToken(),
        "...?fields={fieldname_of_type_Location}",
        null,
        HttpMethod.GET,
        new GraphRequest.Callback() {
            public void onCompleted(GraphResponse response) {
                /* handle the result */
            }
        }
    ).executeAsync();
    

    That's about as far as I've gotten, and hit a dead end. Mainly because I don't know what fields to add in.
    Does anyone know where I can get a good sample for what I'm trying to do?

    Thanks.


Advertisement