Open Audeos opened 2 days ago
for the app, there is no difference between image and video.
on android we are not using deep link (using scheme only on ios), so it's normal that getInitialURL
is always false.
you should use hasShareIntent(getShareExtensionKey());
as mention in the example.
it calls share-intent native module to check if we got pending request to handle.
What I meant is,
const needRedirect = hasShareIntent(getShareExtensionKey());
above expression is false. It's inside getInitialUrl in the link you provide.
async getInitialURL() {
// REQUIRED FOR ANDROID FIRST LAUNCH
const needRedirect = hasShareIntent(getShareExtensionKey());
console.debug(
"react-navigation[getInitialURL] redirect to ShareIntent screen:",
needRedirect,
);
if (needRedirect) {
return `${Constants.expoConfig?.scheme}://shareintent`;
}
// As a fallback, do the default deep link handling
const url = await Linking.getInitialURL();
return url;
},
};
I have applied the linking you provided in react-navigation-example. I also provided below stuff in app.json:
"androidIntentFilters": ["image/*", "video/*"], "androidMultiIntentFilters": ["image/*", "video/*"]
Everything works as intended. However on android release build, if you share files that only contain image, the getInitialUrl function claims needRedirect to be false, and it does not navigate to the screen I asked for it to. It does work if at least one of your shared files is a video. However, even in that case, it's still false. What's different between the video sharing or image sharing is this pending value:
and getInitialUrl looks like to be false all the time.
In development build, neither the ios or android works as intended, probably because expo is in the way. So I had to test these on release build, logging with alerts.