Closed jakac13 closed 1 week ago
I think you'd want to use something like Notification.useLastNotificationResponse()
From https://docs.expo.dev/versions/latest/sdk/notifications/#uselastnotificationresponse:
import * as Notifications from 'expo-notifications';
import { Linking } from 'react-native';
export default function App() {
const lastNotificationResponse = Notifications.useLastNotificationResponse();
React.useEffect(() => {
if (
lastNotificationResponse &&
lastNotificationResponse.notification.request.content.data.url &&
lastNotificationResponse.actionIdentifier === Notifications.DEFAULT_ACTION_IDENTIFIER
) {
Linking.openURL(lastNotificationResponse.notification.request.content.data.url);
}
}, [lastNotificationResponse]);
return (
// Your app content
);
}
Stale, please re-open if issue persists.
Hi,
we have some experience with URL handling for React Native plugin where URL handling for push notifications and in-app messages is handled through native code. I do wonder how do we set up URL handling with expo plugin?
After logging the notification, there seems to be no URL property. Push is sent through journey with open behavior of "Go to Web URL" with a url link. Is there something we are forgetting? I used
Notifications.getLastNotificationResponseAsync()
.Also how would URL handling for in-app messages work here?
I did find this comment from 2023, where it is said that url handling was not implemented. https://github.com/allboatsrise/expo-marketingcloudsdk/issues/22#issuecomment-1737557976
**EDIT: For in-app messages we did notice the marketingcloudsdk log: 'URL https://www.link.com/ was NOT handled - the URL handling delegate method was NOT implemented or delegate nil'
also we did find the url and mediaUrl inside of target object which is probably intended for FCM...