Need to tweet using Fabric SDK android if native twitter app is not installed


I need to tweet if user has not installed Twitter android app. I have searched but nothing found in this regard please suggest.


Hi there,

If using TweetComposer, “In the event that the Twitter app is not installed, TweetComposer will create an intent to interact with in a browser. The browser ignores a specified image.”

If you want to tweet without using TweetComposer, then you can use StatusesService#update to post a tweet directly to the Twitter API.

    TwitterApiClient twitterApiClient = TwitterCore.getInstance().getApiClient(session);
    StatusesService statusesService = twitterApiClient.getStatusesService();
    statusesService.update(status, inReplyToStatusId, possibleSensitive, latitude, longitude,
            placeId, displayCoordinates, trimUser, new Callback<Tweet>() {
        public void success(Result<Tweet> result) {
            //Do something with result, which provides a Tweet inside of

        public void failure(TwitterException exception) {
            //Do something on failure

For more information about StatusesService#update, see the javadocs here:



The link provided by you is not working. Please check and edit it to working one.


Hi aashutoshvinove,

Thanks for the heads up, I just updated my last post (the cut and paste included a trailing /1).



Thanks for the reply. But I am unable to find the doc for using the statement

statusesService.update(status, inReplyToStatusId, possibleSensitive, latitude, longitude, placeId, displayCoordinates, trimUser, new Callback<Tweet>(){
    public void success(Result<Tweet> result) {
        //Do something with result, which provides a Tweet inside of

    public void failure(TwitterException exception) {
        //Do something on failure

I need to post image in my tweet. Please brief about the arguments or provide a link to doc for reference.


Hi there,

Did you download the javadoc jar (twitter-core-1.3.0-javadoc.jar)? From there, you can unpackage it or attach it to your source. I also posted it here.

 * 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=" 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.
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);



As I am in requirement to share the image on twitter. The image is located on the SD Card. I got the content URI of image. Now please suggest how the above function will help me to do so.


Hi aashutoshvinove,

The easiest way to share image on twitter is by using the tweet-composer.

   TweetComposer.Builder builder = new TweetComposer.Builder(this)
        .text("just setting up my Fabric.")

The image Uri should be a file Uri (i.e. :code:file://<absolute_path> scheme) to a local file. For example,

File myImageFile = new File("/path/to/image");
Uri myImageUri = Uri.fromFile(myImageFile);

If you’re using the StatusesService.update, you’ll need to first post the image to Twitter. See for more information.



Hi Lientm,

I have already done that. But in case if user does not have Twitter app installed, it just took me to browser with attached text. I am unable to share the image with that. Please suggest.


If user doesnot have installed Twitter Application then TweetComposer just opens the web browser with specified text. Please suggest how to share image also.


I have commented two times don’t know why the comment is not posted. I have implemented the above code but in case user does not have twitter app installed it just opens a web browser; with which I am unable to share image from SD Card. Please suggest that I have selected in my app. Hoping that this comment will not be deleted.


Hi aashutoshvinove,

At this time, it’s not possible to share an image through the web browser.


@lientm is it currently possible (or will it be possible in the future) to use the TwitterCore StatusesService to post a Tweet with a photo?

I am trying to accomplish posting a status with a photo to our own application, as well as to Twitter and Facebook simultaneously without triggering any additional UI elements or exiting the app to consume an Intent.

It looks like all the internal networking stuff is basically Retrofit, is there anything for posting a status that takes * TypedFiles?


Is it possible to share an image from URL; not local?


@JustinTuchek : Can you please comment the way of posting the image directly without opening browser or twitter app if you are able to accomplice? Even my requirement is to post image directly without any addition UI for user.

@lientm : Please guide us in posting images directly to twitter.


Hi Amt87 do you found any way to share the image from URL?


Sharing the solution from Aman posted here: