Ko Vartthan
Ko Vartthan

Reputation: 454

How to share video in Twitter using Twitter kit 3 in the android?

After fabric removal , now Twitter kit 3 is used in the android

Case :

Upvotes: 4

Views: 843

Answers (2)

Chathura Madhushanka
Chathura Madhushanka

Reputation: 71

It's working on tweet-composer:3.3.0.

I simply added the video Uri to the place where we normally add the image Uri. It worked unexpectedly.

private void shareVideoViaTwitter(File file) {
    try {
        Uri uri = FileProvider.getUriForFile(context, "com.civ.petcam.fileprovider", file);

        context.startActivity(new TweetComposer.Builder(context)
                .text("This video is made with PetCamera")
                .url(new URL("https://play.google.com/store/apps/details?id=com.civ.petcam"))
                .image(uri).createIntent().setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));

        onVideoShareCompleteListener.onVideoShareComplete("twitter");
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

Upvotes: 0

Optional
Optional

Reputation: 4507

1) The native video upload support is only available with iOS (See attachment section)

2) Quick Bad workaround You can convert video to gif and upload it.

3) Proper solution:

You can extend the kit, and use the media/uploads endpoint.

See this to make a post request.

Upvotes: 3

Related Questions