react-native-receive-sharing-intent icon indicating copy to clipboard operation
react-native-receive-sharing-intent copied to clipboard

Opening app deep links

Open LPitonakova opened this issue 4 years ago • 0 comments

Hi,

I am trying to use your library alongside using deeplinks for my app. (like myapp://myPath) The library works well when I share any content with the app. However, on Android, I cannot get it to accept deeplinks.

On iOS, your library correctly understand the "myapp://myPath" link and sets the json received in React Native as:

{"content": "", "contentType": "WEBPAGE", "url": "myapp://myPath"}

However, on Android, this doesn't happen. I have added the intent filter in my AndroidManifest as I am supposed to:

<intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="myapp" />
</intent-filter>

When I call the link myapp://myPath from a browser on Android, the app opens, but the part ReceiveSharingIntent.getReceivedFiles() never gets called.

While whole react native code is:

export default function App() {

  useEffect(() => {
    /**
     * Get the shared content.
     * @param jsonArray_: JSON array in format [{ filePath: null, text: null, weblink: null, mimeType: null, contentUri: null, fileName: null, extension: null }]
     */
    ReceiveSharingIntent.getReceivedFiles(jsonArray_ => {  
      console.log(jsonArray_)
    }, 
    (error) => {
      //-- do nothing on error
 
    });
    console.log("-----")
  
  }, []);

    return (
    <NavigationContainer >
      <DrawerWrapper />
    </NavigationContainer>
  );
}

Am I missing anything that I am supposed to do on Android?

LPitonakova avatar Aug 10 '21 20:08 LPitonakova