我正在 android 中开发 voip 应用程序。我需要从 facebook、twitter、LinkedIn、Google(Buzz、Orkut、Contacts、Gmail)等导入包含姓名和电话号码的联系人。我正在搜索 api 示例。但是我只能看到将状态发布到这些网站的示例,并且没有从 facebook、orkut 或 twitter 等导入联系人的示例。是否有任何用于通过示例导入联系人的 api?
最佳答案
可以使用官方facebook-android-sdk ,并在经过身份验证后执行类似的操作
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" );
(...)
}
关于java - 如何将 Facebook 联系人导入到我的 Android 平台应用程序中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5460171/