I am using Social Auth Api for twitter integration. It is working fine, but I am not getting any method to get friend list (By friend list i mean list of friends following me) from twitter. Is this possible to get this from Social Auth or do I need to implement twitter SDK?
I can't found a way to do this with the SocialAuth API but I found two other ways with another API or a manual call of the official Twitter API. You can use the jTwitter API for Android with this code:
List<User> followers= twitter.getFollowers();
for(int i=0;i<followers.size();i++)
{
User follower=followers.get(i);
String name=follower.getName();
Log.i("follower", name);
}
List<User> following = twitter.getFriends();
for(int i=0;i<following.size();i++)
{
User user=following.get(i);
String name=user.getName();
Log.i("following", name);
}
Or a second way to do this is, that you can use the official Twitter API. For this you need the Screen name from the user and then pass it to an URL and the response is an array of UserIds:
HttpParameters params1 = mProvider.getResponseParameters();
String ScreeName = params1.getFirst("screen_name");
https://api.twitter.com/1/friends/ids.json?cursor=-1&screen_name="+ScreeName
Of course you have to call this in an own Thread
or AsyncTask
. I think the first version is much more easier, because you don't have to think about Thread syncronisation and so on but the second does not require so much space on the phone. It's your decision what is more important for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With