8

I am developing an Android application and would like to have the functionality to send message on my twitter account (TWEET). Which APIs are available for this? Code samples will be appreciated.

Jonik
  • 80,077
  • 70
  • 264
  • 372
user718592
  • 101
  • 1
  • 1
  • 3

1 Answers1

24

If you just need to send a tweet, this can help you.

String tweetUrl = "https://twitter.com/intent/tweet?text=PUT TEXT HERE &url="
                        + "https://www.google.com";
Uri uri = Uri.parse(tweetUrl);
startActivity(new Intent(Intent.ACTION_VIEW, uri));

If you want to know which parameters are available, check this link https://developer.twitter.com/en/docs/twitter-for-websites/tweet-button/guides/parameter-reference1

gian1200
  • 3,670
  • 2
  • 30
  • 59
  • 1
    +1, works nicely. On my Nexus 7 opens a "Complete action using..." dialog with Twitter and Chrome. For those who want to directly open the Twitter app if it's installed, [see this answer](http://stackoverflow.com/a/21186753/56285). – Jonik Jan 17 '14 at 13:18