Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use twitter api in android application for send tweet only

Tags:

android

i want to know about twitter api for android application.... please send me link or source for twitter api which api just only for send the tweet....

like image 487
sam_k Avatar asked Feb 21 '11 04:02

sam_k


People also ask

Can I Tweet using Twitter API?

While not rate limited by the API, a user is limited in the number of Tweets they can create at a time. If the number of updates posted by the user reaches the current allowed limit this method will return an HTTP 403 error.

Can I use Twitter API without authentication?

You can do application-only authentication using your apps consumer API keys, or by using a App only Access Token (Bearer Token). This means that the only requests you can make to a Twitter API must not require an authenticated user.

How do you Tweet programmatically?

First, log in to the Twitter developer's portal with the account from which you want to post a tweet. Then click on the "Developer Portal" link in the upper right corner. Once you enter it, click on "Projects & Apps" -> "Overview" -> "Create App".


Video Answer


2 Answers

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));

For more info, check my answer on this other post

How to tweet from Android app?

like image 96
gian1200 Avatar answered Oct 11 '22 22:10

gian1200


To share some text using standard android intents, only three lines of code are necessary. The user will be prompted to pick a method (and they can then choose Twitter.)

    Intent share = new Intent(Intent.ACTION_SEND);
    share.putExtra(Intent.EXTRA_TEXT, "Here's some text for Twitter.");
    startActivity(Intent.createChooser(share, "Share this via"));

If you want to do more advanced stuff with Twitter:

I found that a lot of the solutions posted on the Internet were needlessly complicated. For me, it was only a couple additional lines of code beyond what Twitter4J tells you to do.

For my dollar, Stephan's answer here is the best.

I have some example code on github using his technique, here.

like image 33
Jameson Avatar answered Oct 11 '22 22:10

Jameson