Handle URL

Prev Next

Handle Deep Link URLs from Insider QR Codes and Email Links. This method is specific to the iOS platform. It is not necessary for Android; it is handled automatically.

Method Signature

static handleURL(url: string): void

Method Example

import Insider from 'react-native-insider';
import { Linking } from 'react-native';

// Handle deep links from QR codes or email links (iOS only)
if (Platform.OS === 'ios') {
  // Handle initial URL if app was opened via deep link
  Linking.getInitialURL().then((url) => {
    if (url && url.includes('insider{YOUR_PARTNER_NAME}')) {
      Insider.handleURL(url);
    }
  });

  // Listen for deep link events
  const urlListener = Linking.addEventListener('url', (event) => {
    if (event.url && event.url.includes('insider{YOUR_PARTNER_NAME}')) {
      Insider.handleURL(event.url);
    }
  });

  // Clean up listener
  return () => urlListener.remove();
}

// Example URL format from Insider panel
// insider{your_partner_name}://test_device/...
Insider.handleURL('insidertestpartner://test_device/...');