Question

I synced my address book with facebook and can now access my facebook profile through my addressbook. I want to read the facebook data that is connected to the account from another application and get the facebook id of the synced user.

I can't find a mimetype or a datafield in the ContactContracts.Data table that contains something related to facebook. Has anybode done this successfully?

It seems that facebook somehow restricts the permissions to this data. How is this done and which permissions do I need to access the facebook contact informations that are synced in the address book?

Was it helpful?

Solution 3

It seems that this is not possible to the official API until now because of this exception that was made for the facebook app by google. I hope facebook complies with the offical android API in its next versions.

OTHER TIPS

If the user has that info in their contacts, then they are also friends with that person on facebook. Just use the graph api and get the list of friends and filter them with the contact name selected or let the user select from a listview which is made from the returned names of the facebook api query.

try {
    JSONObject response = Util.parseJson(facebook.request(
    "/me/friends", new Bundle(), "GET"));

    JSONArray jArray = response.getJSONArray("data");

    for (int i = 0; i < jArray.length(); i++) {
        JSONObject json_data = jArray.getJSONObject(i);
        tempMap = new HashMap<String, Object>();
        tempMap.put("friend", json_data.getString("name"));
        tempMap.put("id", json_data.getString("id"));
        friendlist.add(tempMap);
    }
} catch (MalformedURLException e) {
    e.printStackTrace();
} catch (JSONException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
} catch (FacebookError e) {
    e.printStackTrace();
}

You can also consider working with the APIs and android SDK offered by gigya.com (where I used to work until recently).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top