ARIJIT
ARIJIT

Reputation: 515

Facebook, Twitter and Gmail Integration to share links from my Android Application

I have successfully posted the page( share the links) to facebook from my android app using Facebook API. But facing lots of problems using Twitter API to do the same. Can you please suggest me how to overcome this problem. Because I have found one API integrated for all social networking sites, but it is used to share only the status(not as per my requirement). Also how to do it for Gmail???

Upvotes: 1

Views: 893

Answers (1)

Babu
Babu

Reputation: 957

I had same problem and i found this tutorial really helpful, please check this:

http://blog.doityourselfandroid.com/2011/02/13/guide-to-integrating-twitter-android-application/

public static void sendTweet(SharedPreferences prefs,String msg) throws Exception {
    String token = prefs.getString(OAuth.OAUTH_TOKEN, "");
    String secret = prefs.getString(OAuth.OAUTH_TOKEN_SECRET, "");

    AccessToken a = new AccessToken(token,secret);
    Twitter twitter = new TwitterFactory().getInstance();
    twitter.setOAuthConsumer(Constants.CONSUMER_KEY, Constants.CONSUMER_SECRET);
    twitter.setOAuthAccessToken(a);
    twitter.updateStatus(msg);
}

Upvotes: 2

Related Questions