Loading
Feature Disruption - Service Cloud VoiceRead More
Feature degradation | Gmail Email delivery failureRead More
Mobile Publisher for Experience Cloud
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Override Android App Links to Your Mobile Publisher App

          Override Android App Links to Your Mobile Publisher App

          Mobile Publisher for Experience Cloud apps support app links on Android. By default, when a user taps an app link to your Mobile Publisher app, the link opens to the page inside your app. To override the default behavior and set certain links to open outside of your app, use an Apex class and a Visualforce page. For example, if you want the link to your app’s registration page to open in a web browser.

          Complete these steps to override the default behavior of app links to your Android app.

          1. Create an Apex class named ReDirectToCustomUniversalAndAppLinks.
            Note
            Note You must use the same Apex class for both the Android and iOS versions of your app. If you already created the ReDirectToCustomUniversalAndAppLinks Apex class for the iOS version of your app, continue to step 2.
            1. From Setup, in the Quick Find box, enter Apex Classes, and then select Apex Classes.
            2. Click Developer Console.
            3. In the Developer Console, click File, select New, and then select Apex Class.
            4. Name the class ReDirectToCustomUniversalAndAppLinks.
            5. Add this code to the Apex class.
              global class ReDirectToCustomUniversalAndAppLinks implements Site.UrlRewriter {
                global PageReference mapRequestUrl(PageReference srcUrl) {
                  String url = srcUrl.getUrl();
                  // Code for Android
                  if (url!=null && url.endsWith('assetlinks.json')) {
                    url = '/CustomAssetLink';
                    return new PageReference(url);
                  }
                  // Code for iOS
                  if (url!=null && url.endsWith('apple-app-site-association')) {
                    url = '/CustomAASA';
                    return new PageReference(url);
                  }
                return null;
              }
              global PageReference[] generateUrlFor(PageReference[] srcUrls) {
                return null;
              }
              }       
          2. Create a Visualforce page named CustomAssetLink.
          3. Edit this sample Visualforce markup to define the pages in your Experience Cloud site to open outside of your app.
            1. For the value of package_name, replace YOUR_ANDROID_APP_PACAKGE_NAME with your app’s package name.
            2. For the value of sha256_cert_fingerprints, replace the example value with your app’s SHA-256 fingerprint.
            3. To override certain links to your app, add and define new values in the relation field.

            CustomAssetLink.vfp

            <apex:page standardStylesheets="false" sidebar="false"
                                  showHeader="false"
                                  applyHtmlTag="false"
                                  applyBodyTag="false" contentType="text/json">
            [
              {
                "relation": [
                  "delegate_permission/common.handle_all_urls"
                ],
                "target": {
                  "namespace": "android_app",
                  "package_name": "YOUR_ANDROID_APP_PACAKGE_NAME",
                  "sha256_cert_fingerprints": [
                 "AB:C1:2D:E3:FG:45:67:8H:IJ:K9:01:23:LM:2N:OP:Q4:R5:67:ST:8U:90:12:V3:45:6W:XY:78:9Z:AB:C0:1D:23"
                  ]
                }
              }
            ]
            </apex:page>
            
          4. Enter the edited markup into the Visualforce Markup field of the CustomAssetLink Visualforce page, and save.
          5. Make the CustomAssetLink Visualforce page available to your Experience Cloud site and mobile app.
            1. From Setup, in the Quick Find box, enter Visualforce Pages, and then select Visualforce Pages.
            2. Click the CustomAssetLink label for the Visualforce page that you created.
            3. In the Page Detail settings, select Available for Lightning Experience, Experience Builder sites, and the mobile app.
            The Visualforce page settings for CustomAssetLink
          6. Enable the CustomAssetLink Visualforce page for your Experience Cloud site.
            1. From Setup, in the Quick Find box, enter Sites, and then select Sites.
              Entering Sites in the Setup Quick Find box and the link to Sites
            2. Click the site label for your Mobile Publisher app’s Experience Cloud site.
            3. Click Public Access Settings.
            4. Click Enabled Visualforce Page Access.
              The link to Enabled Visualforce Page Access from the top of a site's profile page
            5. Click Edit, and then add the CustomAssetLink page to the list of enabled Visualforce pages.
            6. Save your changes.
          7. Set the ReDirectToCustomUniversalAndAppLinks Apex class as the URL rewriter for your Experience Cloud site.
            1. In the Site Detail section of your Experience Cloud site, click Edit.
              The Edit button at the top of a site's detail page
            2. In the URL Rewriter Class field, search for and select the ReDirectToCustomUniversalAndAppLinks Apex class.
            3. Save your changes.
           
          Loading
          Salesforce Help | Article