Hi,
We provide a StatusesService that you can use to post a tweet. To get the StatusesService,
StatusesService statusesService = Twitter.getApiClient(session).getStatusesService();
statusesService.update(...)
Here’s javadoc for the method:
/**
* Updates the authenticating user's current status, also known as tweeting.
* <p>
* For each update attempt, the update text is compared with the authenticating user's recent
* tweets. Any attempt that would result in duplication will be blocked, resulting in a 403
* error. Therefore, a user cannot submit the same status twice in a row.
* <p>
* 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.
*
* @param status (required) The text of your status update, typically up to 140 characters. URL
* encode as necessary. [node:840,title="t.co link wrapping"] may effect character
* counts. There are some special commands in this field to be aware of. For
* instance, preceding a message with "D " or "M " and following it with a screen
* name can create a direct message to that user if the relationship allows for
* it.
* @param inReplyToStatusId (optional) The ID of an existing status that the update is in reply
* to. Note:: This parameter will be ignored unless the author of the
* tweet this parameter references is mentioned within the status text.
* Therefore, you must include @username, where username is the author
* of the referenced tweet, within the update.
* @param possiblySensitive (optional) If you upload Tweet media that might be considered
* sensitive content such as nudity, violence, or medical procedures,
* you should set this value to true. See Media setting and best
* practices for more context. Defaults to false.
* @param latitude (optional) The latitude of the location this tweet refers to. This parameter
* will be ignored unless it is inside the range -90.0 to +90.0 (North is
* positive) inclusive. It will also be ignored if there isn't a corresponding
* long parameter.
* @param longitude (optional) The longitude of the location this tweet refers to. The valid
* ranges for longitude is -180.0 to +180.0 (East is positive) inclusive. This
* parameter will be ignored if outside that range, if it is not a number, if
* geo_enabled is disabled, or if there not a corresponding lat parameter.
* @param placeId (optional) A place in the world. These IDs can be retrieved from [node:29].
* @param displayCoordinates (optional) Whether or not to put a pin on the exact coordinates a
* tweet has been sent from.
* @param trimUser (optional) When set to either true, t or 1, each tweet returned in a timeline
* will include a user object including only the status authors numerical ID.
* Omit this parameter to receive the complete user object.
* @param cb The callback to invoke when the request completes.
*/
@FormUrlEncoded
@POST("/1.1/statuses/update.json")
void update(@Field("status") String status,
@Field("in_reply_to_status_id") Long inReplyToStatusId,
@Field("possibly_sensitive") Boolean possiblySensitive,
@Field("lat") Double latitude,
@Field("long") Double longitude,
@Field("place_id") String placeId,
@Field("display_cooridnates") Boolean displayCoordinates,
@Field("trim_user") Boolean trimUser,
Callback<Tweet> cb);