I have facing one issue while sharing the content from my app using android intent. The content that I'm sharing is present in app's private memory.
I'm using FileProvider for sharing and am able to share it on some of the app (like : Twitter, Gmail, Whatsapp). But however for some reason when I'm selecting the Viber from App chooser, it is showing a blank screen.
If I change the content location to external SD card, then it is working fine even for Viber also.
My problem is that if I change the content location to sd card then I have to use the WRITE_STORAGE_PERMISSION, which I don't want.
Please help on how this can be done for Viber, without moving the content and without using any extra permission as it is possible to share on other apps.
Code for sharing intent
Uri imageUri = FileProvider.getUriForFile(context, "packagemane.pdffilesprovider", newFile);
shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
shareIntent.setType("*/*");
shareIntent.putExtra(Intent.EXTRA_TEXT, content +"\n"+url);
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
FileProvider in manifest
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="cpackagemane.pdffilesprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/fileprovider" />
</provider>
fileprovider.xml file
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
<files-path name="my_images" path="images/"/>
</paths>