Why doesn't Twitter app share animated gifs?

I recently noticed that when sharing an animated .gif file that I create from my application, the official application will only pass it as a static image.

I used to think everything was working because when I was sharing the same type of animated .gif with an unofficial Twitter app (Tweetcaster) it correctly shared it as an animated .gif.

What I'm interrogating is a question on my end or on the official Twitter app? I'm asking this because when you share an animated .gif from Android Gallery with the official Twitter app, it is hosted as a static .gif as well.

Here is the code in question:

public void shareGif(String path)
    {       
        File file = new File(path);
        Uri uri = Uri.fromFile(file);

        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("image/gif");
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
        intent.putExtra(Intent.EXTRA_SUBJECT, "subject");
        intent.putExtra(Intent.EXTRA_TEXT, "text");
        intent.putExtra(Intent.EXTRA_STREAM, uri);

        startActivity(Intent.createChooser(intent, "Choose a sharing option"));
    }

      

+3


source to share


2 answers


I had the same problem as you. I was loading URI from blueprints and for not animating.

I fixed my problem by implementing a file provider and loading the GIF from the assets folder.



It was also very important to add this flag intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

0


source


Twitter supports looping GIFs. If your animated GIF doesn't loop and plays in one go, it will display as a static image.



0


source







All Articles