2016-04-23 9 views
0

ich benutzerdefinierten nativen Modul gemacht habe für Native reagieren, die die Bilder aus Pfad teilen müssen /data/user/0/com.instagramscheduler/files/downloaded.jpg (dass meine Anwendung ist) und klar Datei in diesem Ordner vorhanden sein.Reagieren Bild Mutter Sharing von DocumentDirectoryPath Instagram

Aber das Problem ist, dass es nicht teilt, wenn ich auf Instagram teile es sagt, dass es nicht möglich ist, Datei zu laden. Ich habe überprüft und uri.toString() == "file:///data/user/0/com.instagramscheduler/files/downloaded.jpg"

india Brauch Anteil Methode Reagieren My:

public void share() { 
    // Create the new Intent using the 'Send' action. 
    Intent share = new Intent(Intent.ACTION_SEND); 

    // Set the MIME type 
    share.setType("image/jpeg"); 
    share.setPackage("com.instagram.android"); 

    // Create the URI from the media 
    File media = new File("/data/user/0/com.instagramscheduler/files/downloaded.jpg"); 
    Uri uri = Uri.fromFile(media); 

    // Add the URI to the Intent. 
    share.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
    share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); 
    share.putExtra(Intent.EXTRA_STREAM, uri); 

    // Broadcast the Intent. 
    activity.startActivity(Intent.createChooser(share, "Share To")); 
} 

Hier ist mein manifest, wenn es hilft:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.instagramscheduler"> 

<uses-permission android:name="android.permission.INTERNET" /> 

<application 
    android:allowBackup="true" 
    android:label="@string/app_name" 
    android:icon="@mipmap/ic_launcher" 
    android:theme="@style/AppTheme"> 
    <activity 
    android:name=".MainActivity" 
    android:label="@string/app_name" 
    android:screenOrientation="portrait" 
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"> 
    <intent-filter> 
     <action android:name="android.intent.action.MAIN" /> 
     <category android:name="android.intent.category.LAUNCHER" /> 
    </intent-filter> 
    </activity> 
    <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> 
</application> 

Hier ist logcat wenn benötigt (ab dem Öffnen des Freigabedialogs bis zur Freigabe) auf Instagram): https://gist.github.com/Azael05x/f706925668ce9b8dd9970a81ed23e979

Antwort

1
  1. Als ich das Herunterladen und Bilder anstelle des Sparens Bild auf Ihren Anwendungsordner zu speichern, um es zu public folder speichern. Und es hat funktioniert, weil Instagram keinen Zugriff auf die privaten Ordner meiner Apps hatte.
  2. Dann habe ich auf einem anderen Telefon überprüft und es hat dort nicht funktioniert. Grund war, dass Instagram mit deaktivierter Speicherberechtigung versehen war.
Verwandte Themen