I would like to know which is the best way to implement url handling in React Native. There is documentation for both android and iOS (link at the bottom) on how to do that but when it comes to React Native there is no information anywhere. For Android there are pieces of code in Kotlin and for iOS happens the same but in Swift.

As you know, React Native uses Java/Objective-c out of the box and there is no clarification on how to implement those changes in those language. I think RN is wired differently and I do not know if is a matter of translating the code and putting it in the same place as the other documentation says. Some guidance would be much apreciated.



2 Answers 2


UrlHandling is passed into the MarketingCloudConfig. As such, you must implement it in native code. Examples of this can be seen in the Learning Applications: https://github.com/salesforce-marketingcloud/MarketingCloudSDK-Android/blob/master/app/src/main/java/com/salesforce/marketingcloud/learningapp/BaseLearningApplication.kt#L126


hope this will works,

                new NotificationLaunchIntentProvider() {
                    public PendingIntent getNotificationPendingIntent(@NonNull Context context, @NonNull NotificationMessage notificationMessage) {
                        if(notificationMessage.url() != null && !notificationMessage.url().isEmpty()){
                            return PendingIntent.getActivity(context, new Random().nextInt(), new Intent(Intent.ACTION_VIEW, Uri.parse(notificationMessage.url())),
                                PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE
                        }else {
                            return PendingIntent.getActivity(context, new Random().nextInt(),
                                    PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE
                }, null))
  • Code dumps make for bad answers. The explanation of how a solution works is as important as the solution itself.
    – Derek F
    Commented Nov 23, 2022 at 20:52
  • It's suggested to implement handling url native end by the RN library itself. Commented Nov 24, 2022 at 5:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .