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?
How to get friend list of twitter using Social Auth in android?
Asked Answered
have you read this: github.com/3pillarlabs/socialauth-android/wiki/Getting-Contacts –
Yearning
yes i have read but its return list of user which i have follow and as a said i need a list of user which is following me –
Dulsea
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.
i had already tried this its working good, but i am using multiple social media like linkedin, facebook etc and for this socialAuth is best –
Dulsea
© 2022 - 2024 — McMap. All rights reserved.