Twitter Share Photo on Nougat



I’m trying to Share photo on Android Nougat and Twitter SDK wants me to share it via “Uri.fromFile”, but since Api 25 we can’t do that.
As stated in article:

We need to share it via FileProvider, but It doesn’t work as expected.
As far as I can see, you need to change this inside SDK. I’ve made everything in the same way as in article and it doesn’t work.

Any advice?


Thank you for the issue report. When you tried FileProvider what error did you get? Any more details would be helpful in addressing the issue.


This is what I do:

Uri uri = FileProvider.getUriForFile(getContext(), getContext().getPackageName() + “.file_provider”, file)

It used to be

Uri uri = Uri.fromFile(file);

And this creates intent, the same way documentation says:

new TweetComposer.Builder(getContext()).text(tweetText).image(uri).createIntent()

This is screenshot from my device (sorry for Polish lang, but you’ll find correct string:))

I’m not 10000% sure that this isn’t my fault, but I have no idea who should I do it in different way. File provider generates link, so I guess it should be fine:)


Using a FileProvider should work. Looks like the file might not actually exist? I will be sure to update our documentation to reflect the latest changes in Android N.


I noticed that the docs hadn’t been updated yet and there doesn’t seem to be anything in the changeling for the composer.

I am still seeing this issue and I want to make sure it isn’t me.

Did this get fixed yet or was the team still working on it. Thanks in advance.


The docs have been updated. See: