LogoLogo
  • Home
  • Integration & SDKs
    • Web / Browser Push
      • Wordpress Integration Steps
      • Wix Integration Steps
      • Safari
        • Safari on Desktop
        • Safari on Mobile (iOS / iPadOS)
      • SDK
        • SDK Methods
        • SDK Events
        • Customizing Prompt CSS
        • AMP Support
        • E-Commerce / Abandoned Cart
    • Native App Push
      • Apple / iOS
        • P8 Key or P12 Cert Setup
        • SDK: Swift / Obj-C
          • Activity Tracking
          • Deep Linking
          • Live Activities
          • App Messages
          • Identity Synchronization
          • SDK Methods
          • SDK Delegates
        • SDK: React Native
        • SDK: Flutter
        • Advanced
          • Self-Managed Integration
        • iOS SDK Changelog
      • Android
        • Firebase App Setup
        • SDK: Kotlin / Java
          • Deep Linking
          • Activity Tracking
          • App Messages
          • Identity Synchronization
          • SDK Methods
          • SDK Callbacks
          • Live Activities
        • SDK: React Native
        • SDK: Flutter
        • Advanced
          • Self-Managed Integration
        • Android SDK Changelog
      • React Native
        • Android: Firebase App Setup
        • iOS: P8 Key or P12 Cert Setup
        • SDK: React Native
          • Deep Linking
          • Activity Tracking
          • Subscriber Matching
          • Live Activities
          • App Messages
          • SDK Methods
      • Flutter
        • Android: Firebase App Setup
        • iOS: P8 Key or P12 Cert Setup
        • SDK: Flutter
          • Deep Linking
          • Activity Tracking
          • Subscriber Matching
          • Live Activities
          • App Messages
          • SDK Methods
  • API
    • API Access Management
    • API Reference
  • Platform
    • Dashboard
    • Notifications
      • A/B Testing
      • Custom Buttons
      • Notification Previews
      • Inline Segmentation
      • Notification Templates
      • Macros
      • Native App Push Notifications
    • App Messages
    • Segments
      • Custom Geo Segmentation
    • Campaigns
    • Insights
    • User Management
    • Organizations
      • Multi-Factor Authentication
      • Single Sign On
        • Google Workspace
        • Microsoft Azure AD
        • Okta Workforce
      • Multi-Domain Notifications
      • Multi-Domain Segments
      • API Access
    • Multi-Channel Notifications
  • Info Center
    • Launch Guide & Best Practices
      • Landing Domain Whitelist
    • Web / Browser Push
      • Common Questions
      • Browser Support
      • Retrieve Push User ID
      • Not Getting Prompted
      • Not Receiving Notifications
      • How to Unsubscribe
    • Native App Push
      • Retrieve Push User ID
    • Workflow Planning
Powered by GitBook
On this page
  • Implementing URL Handling Callbacks
  • Notification Interaction Callbacks
  • Notification Opened With URI/URL Destination
  1. Integration & SDKs
  2. Native App Push
  3. React Native
  4. SDK: React Native

Deep Linking

Overview of how the SDK handles deep links and how to perform custom navigation within your application

The PushSDK handles opening of a notification in the following ways:

Android

  • By default, the SDK will automatically create a new ACTION_VIEW intent using the landing URL attached to the notification.

iOS

  • By default, the SDK will automatically call the open method using the landing URL attached to the notification.

If you implement the onPushSDKDidReceiveNotificationDestination lifecycle callback you can perform any custom logic needed when the notification is opened.

Implementing URL Handling Callbacks

The PushSDK provides callbacks that will be called when a subscriber interacts with a notification. These callbacks should be implemented so that the subscriber is automatically navigated to the proper activity after opening the notification.

It is recommend to put all SDK callbacks within your application's index.tsx or app.tsx file to ensure proper handling of all notification events.

When the SDK receives a notification open event it will attempt to call one of the below callbacks with parameters that you can use to navigate the subscriber to the appropriate activity within your app.

In order to implement these callbacks you can use SDK's registerNotificationLifecycleCallbacks method and implements the callback(s) within it.

import PushSDK from '@pushly/push-sdk-react-native';

...
PushSDK.registerNotificationLifecycleCallbacks({
    // Add function overrides here
});

For example, if a landing URL was attached to the notification and you implemented the callback to handle subscriber navigation your method the code may look like this:

import PushSDK, { NotificationInteraction } from '@pushly/push-sdk-react-native';

...
PushSDK.registerNotificationLifecycleCallbacks({
    onPushSDKDidReceiveNotificationDestination(
        destination: string,
        interaction: NotificationInteraction
    ): boolean {
        // Navigate to a activity within your application using the destination (the Landing URL)
        
        // Return true to inform the SDK that it should not navigate 
        return true;
    }
});

Notification Interaction Callbacks

Notification Opened With URI/URL Destination

Use this callback when you need to perform custom parsing and/or modification of the attached landing URL that wouldn't be properly handled by opening the URL directly.

This callback is invoked when a notification is opened that has destination landing URL attached. The subscriber should be navigated to the view that represents the provided landing URL.

This method expects a boolean response. If the response is true then the SDK will perform no additional actions for this notification open. If the response is false then the SDK will attempt to navigate the subscriber to the destination URL.

onPushSDKDidReceiveNotificationDestination(
    destination: string,
    interaction: NotificationInteraction
): boolean {
    // Navigate to a activity within your application using the destination (the Landing URL)
        
    // Return true to inform the SDK that it should not navigate 
    return true;
}
PreviousSDK: React NativeNextActivity Tracking

Last updated 2 years ago