Android: Uploading video from my app using Twitter Kit sdk




I have an Android app and I integrated Fabric sdk in order to authenticate with Twitter. Also I’m creating a small video in the app and I want to tweet\upload video to Twitter. How can achieve this, I didn;t find any api samples in documentation?.

Thank you.


Hey @CaptainSiv, video uploads aren’t currently built-in to Twitter Kit but you can extend Twitter Kit and use the media/uploads endpoint to upload a video.


Hi alexsinger,

Thank your for your response.I followed your instructions and I was able to requesti INIT method, I get the media_id response but when I call APPEND method I get "Invalid command HTTP error 400"
Code snippets:

void uploadVideoAppend(@Part("command") String command,
                                        @Part("media_id") String mediaId,
                                        @Part("segment_index") String segmentIndex,
                                        @Part("media") RequestBody media 

requestBody = new RequestBody() {
                    public MediaType contentType() {
                        return MediaType.parse("video/mp4");

                    public void writeTo(final BufferedSink sink) throws IOException {
                        sink.write(data, 0, fileSize);

                apiService.uploadVideoAppend("APPEND", String.valueOf(mediaId), String.valueOf(0), requestBody)

Android Tweet Video


It was my mistake in calling retrofit methods. All methods for video upload is now working well, but I can’t see my video on Twitter account.

Thank you.


You need to post a new Tweet with the mediaId attached.


Thank you andypiper for your response,

What API should I use to post a new Tweet without using TweetComposer?

Thank you again.


I found it. You can close the topic.Thank you


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.