0

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>
Sanjeet
  • 2,385
  • 1
  • 13
  • 22
  • Please show your code. – Divers Jan 06 '17 at 10:09
  • @Divers please have a look, I have added the code – Sanjeet Jan 06 '17 at 10:17
  • Seems like that answer should help you - http://stackoverflow.com/questions/40613643/how-to-share-image-to-viber-app-via-file-provider – Divers Jan 06 '17 at 10:30
  • @Divers Thanks for the suggestion, I tried to use it but doesn't help. Also I tried to the demo app from **commonsware** and in demo app also I'm not able to share using viber. – Sanjeet Jan 09 '17 at 04:25

0 Answers0