Deep Linking

Deep Linking

To redirect users to a specific page or view in your app via push notifications with custom action buttons, you can use deep links. Follow these steps to set up deep linking in your app:

  1. Set Up a URL Scheme In your Xcode project, define a custom URL scheme (netmera://).

  2. Configure Info.plist

    • Open your Info.plist file.

    • Add a new key: URL types. Xcode will create an array with a dictionary called Item 0.

    • Inside Item 0, add:

      • URL identifier > Set it to your custom scheme.

      • URL Schemes >This creates an array.

      • Item 0 inside URL Schemes > Set it to your custom scheme.

  3. Handle the Deep Link Add this method to your app delegate:

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool
{
    //handle URL here to navigate to custom views

    return true
}

Scheme and Host Properties

You can use the scheme and host of a URL to navigate to different screens in your app.

For example, if you have deep links like netmera://screenOne and netmera://screenTwo, the scheme is netmera, and the host tells you which screen to show (screenOne or screenTwo).

Here’s how you can use it in code:

Netmera SDK triggers openURL when users tap a notification. To ensure deep linking works properly, implement Netmera Delegate:

  1. Configure the Project

  • Add "Associated Domains" capability.

  • In the domain section, add entries like applinks:www.mywebsite.com.

  1. Configure the Website

Create an apple-app-site-association file:

circle-info
  • Host this file on your HTTPS server at / or /.well-known/.

  • The appID consists of the Team ID (found in Apple Developer Account) and the App Bundle ID (found in the project).

  • Specify the paths the app supports (e.g., /products).

Implement the following method in your AppDelegate:

User Experience

  • Using userActivity methods will prompt users with "Open in Safari or in the application?" when clicking a notification.

  • Handling Universal Links via Netmera Delegate methods (shouldHandleOpenUrl and handleOpenUrl) will direct users straight to the app.

For further details, refer to the Apple documentation herearrow-up-right.

Last updated

Was this helpful?