alinz / react-native-share-extension

react-native as an engine to drive share extension
MIT License
763 stars 398 forks source link

Share image/link to my existing application not on another screen which you demonstrated like share #107

Open rf1804 opened 6 years ago

rf1804 commented 6 years ago

I want to share images/link from outside and i just want whenever i share things from outside, my app gets opened up and the value gets stored in my app or show in console, i do not want some other window for share particularly. I tried playing around i think i've reached somewhere in middle of it but not completely what i want. Please help me out as right now when i share images/links, app gets opened up and instantly get closed up no crash no console nothing.

Here is my code

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example"
    android:versionCode="1"
    android:versionName="1.0">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.USE_FINGERPRINT" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="true"
      android:largeHeap="true"
      android:theme="@style/AppTheme">
      <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:screenOrientation="portrait"
        android:launchMode="singleTop"
        android:windowSoftInputMode="adjustPan">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
        </intent-filter>
        <intent-filter>
          <action android:name="android.intent.action.SEND" />
          <category android:name="android.intent.category.DEFAULT" />
         //  for sharing links include
          <data android:mimeType="text/plain" />
         //  for sharing photos include
         <data android:mimeType="image/*" />
        </intent-filter>
      </activity>
      <provider
            android:name="com.vinzscam.reactnativefileviewer.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_viewer_provider_paths"
            />
        </provider>
    </application>

</manifest>

There is no share folder in java/com as i don't want to open some other window so i just imported your package in MainApplication.java. There is no appregistery as i am using wix/react-native-navigation, i'm just trying to fetch the shared value on first screen of my app.

ekeuus commented 5 years ago

Were you able to solve this?