开发者

How to import facebook contacts into my app built on android platform?

I am 开发者_如何学Pythondeveloping voip application in android.And i need to import contacts with name and phone number from facebook, twitter, LinkedIn, Google(Buzz,Orkut,Contacts,Gmail) etc.I am searching for the api example.But i could see only examples for posting status into those site and there is no example for importing contacts from facebook,orkut or twitter etc,.Is there any api's for importing contacts with example?


You can use the official facebook-android-sdk, and do something like this after being authenticated

Bundle parameters = new Bundle();
parameters.putString( "fields", "id,name" ); //see the link below to have the fields list

String response = facebook.request( "me/friends", parameters ); 

JSONObject json = Util.parseJson( response );

JSONArray data = json.getJSONArray( "data" );

for ( int i = 0, size = data.length(); i < size; i++ )
{
    JSONObject friend = data.getJSONObject( i );

    String id = friend.getString( "id" );
    String name = friend.getString( "name" );
    (...)
}

Fields list

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜