Deep Linking

Prev Next

Overview

Deep Linking enables your Android application to open specific pages or sections directly in response to user actions, such as clicking on a push notification or a hyperlink. This feature enhances user engagement by providing seamless navigation to relevant app content.

Use Case

  1. Purpose:

    • Navigate users to specific in-app locations from external sources.

    • Drive engagement with personalized and targeted app experiences.

  2. Benefits:

    • Simplify navigation for users by bypassing general entry points like the home screen.

    • Enable marketing campaigns that direct users to promotional pages or specific features.

Implementation Details

  1. Standardized URI Requirements:

    • Define URI schemes and host paths to configure deep linking.

    • Ensure URI compatibility with app actions specified in the manifest.

  2. Manifest Configuration: Add the following intent filter in the app's AndroidManifest.xml to specify deep link handling:

    <activity android:name=".DeepLinkActivity">
    	<intent-filter>
    		<data android:scheme="apx"/>
    		<data android:host="deeplink"/>
    		<action android:name="com.appoxee.VIEW_DEEPLINK"/>
    		<category android:name="android.intent.category.DEFAULT"/>
    		<category android:name="android.intent.category.BROWSABLE"/>
    		<category android:name="${applicationId}" />  //mandatory for Android FCM SDK v6.0.9 and later
    	</intent-filter>
    </activity>
  3. Activity Setup: Create a DeepLinkActivity to handle deep links:

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            
            if (getIntent() != null) {
                handleIntent(getIntent());
            }
        }
        
        @Override
        protected void onNewIntent(Intent intent) {
            super.onNewIntent(intent);
            handleIntent(intent);
        }
    
        private void handleIntent(Intent intent) {
            if (APX_LAUNCH_DEEPLINK_ACTION.equals(intent.getAction())) {
                Uri uri = intent.getData();
                finalLink = uri.getQueryParameter("link");
                String protocol = uri.getScheme();
                String server = uri.getAuthority();
                String path = uri.getPath();
                String query = uri.getQuery();
                String link = uri.getQueryParameter("link");
                String messageId = uri.getQueryParameter("message_id");
    
                // use data from deep link to open WebBrowser, another Activity, etc.
            }
        }

Keep in mind:

  • Ensure deep link URIs are well-documented for marketing and campaign teams.

  • Test deep link functionality across different Android versions to validate compatibility.

  • Include fallback mechanisms for unsupported or malformed links.