Deep linking
Register a deeplink callback
Section titled “Register a deeplink callback”Public API:
public static void RegisterDeeplinkCallback(DeeplinkCallback callback)—Runtime/Affise.cs:88public delegate void DeeplinkCallback(DeeplinkValue value);—Runtime/Deeplink/IOnDeeplinkCallback.cs:6public class DeeplinkValue—Runtime/Deeplink/DeeplinkValue.cs:8
DeeplinkValue fields:
| Field | Type |
|---|---|
| Deeplink | string |
| Scheme | string? |
| Host | string? |
| Path | string? |
| Parameters | Dictionary<string, List<string>> |
Example:
Affise.RegisterDeeplinkCallback((value) =>{ // full uri "scheme://host/path?parameters" var deeplink = value.Deeplink;
// separated for convenience var scheme = value.Scheme; var host = value.Host; var path = value.Path; var queryParametersMap = value.Parameters;
if(queryParametersMap["<your_uri_key>"]?.Contains("<your_uri_key_value>") == true) { // handle value }});Custom-scheme deeplinks
Section titled “Custom-scheme deeplinks”Android deeplinks are handled via an intent-filter declaring android:autoVerify="true" inside AndroidManifest.xml, with a custom scheme (not http/https)..
Test with:
adb shell am start -a android.intent.action.VIEW -d "YOUR_SCHEME://YOUR_DOMAIN/somepath?param=1&list=some&list=other&list="iOS deeplinks are configured via CFBundleURLTypes inside Info.plist..
Test with:
xcrun simctl openurl booted "YOUR_SCHEME://YOUR_DOMAIN/somepath?param=1&list=some&list=other&list=1"Test command references:.
Universal Links / App Links
Section titled “Universal Links / App Links”Android App Links use an intent-filter with https / http schemes plus a Digital Asset Links file (/.well-known/assetlinks.json) hosted at your domain..
iOS Universal Links require a com.apple.developer.associated-domains entitlement entry..
Deferred deeplink
Section titled “Deferred deeplink”Public API:
public static void GetDeferredDeeplink(OnReferrerCallback callback)—Runtime/Affise.cs:238public static void GetDeferredDeeplinkValue(ReferrerKey key, OnReferrerCallback callback)—Runtime/Affise.cs:250public delegate void OnReferrerCallback(string? value);—Runtime/Referrer/OnReferrerCallback.cs:4
Example:
Affise.GetDeferredDeeplink(deferredDeeplink => { // handle deferred deeplink});Example for value retrieval (Runtime/Affise.cs:250):
Affise.GetDeferredDeeplinkValue(ReferrerKey.CLICK_ID, deferredDeeplinkValue => { // handle deferred deeplink value});See Referrer for the full ReferrerKey enumeration.