Deep links are used to send users directly to specific in-app locations, producing a seamless user journey and improving conversion rates. If a user already has your app installed and clicks on your deep link, SolarEngine SDK will open your app, parse the deep link information, and direct users to the page where you wanted them to land. This chapter will introduce necessary steps to generate deep links in SolarEngine.
This method applies to both Android and iOS.
Universal Link Example: test1.link.solar-engine.com

URL Scheme Example: test1://

Add the code below in native/engine/ios/CMakeLists.txt
// First find this line
set(CC_ALL_SOURCES)
// Then add
list(APPEND CC_PROJ_SOURCES
${CMAKE_CURRENT_LIST_DIR}/SolarEngineSDK/iOS/SECocosCreatorProxyApi.h
${CMAKE_CURRENT_LIST_DIR}/SolarEngineSDK/iOS/SECocosCreatorProxyApi.mm
${CMAKE_CURRENT_LIST_DIR}/SolarEngineSDK/iOS/SECCAppDelegate.h
${CMAKE_CURRENT_LIST_DIR}/SolarEngineSDK/iOS/SECCAppDelegate.m
)
Add the code below in native/engine/ios/Post-service.cmake
if(IOS)
# Supported for .framework
cs_neteaseyidun_append_string_property(${CC_TARGET_NAME} XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS ${CMAKE_CURRENT_LIST_DIR}/SolarEngineSDK/iOS/Frameworks)
cs_neteaseyidun_append_string_property(${CC_TARGET_NAME} XCODE_ATTRIBUTE_OTHER_LDFLAGS "-ObjC -fprofile-instr-generate -lz -lc++")
target_link_libraries(${CC_TARGET_NAME} "-framework SolarEngineSDK")
target_link_libraries(${CC_TARGET_NAME} "-framework SESDKRemoteConfig")
target_link_libraries(${CC_TARGET_NAME} "-framework AdSupport")
target_link_libraries(${CC_TARGET_NAME} "-framework AdServices")
target_link_libraries(${CC_TARGET_NAME} "-framework Security")
target_link_libraries(${CC_TARGET_NAME} "-framework CoreTelephony")
# deeplink
set_target_properties(${CC_TARGET_NAME} PROPERTIES
# URL Scheme
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist"
# universal link
XCODE_ATTRIBUTE_CODE_SIGN_STYLE "Automatic" # Automatic表示打包使用自动签名
XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "你开发者账号的TeamID"
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/SolarEgine.entitlements"
)
endif()Add the code below in native/engine/ios/Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
....
// deeplink-start
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>solarengine</string>
<key>CFBundleURLSchemes</key>
<array>
<string>test1</string>
</array>
</dict>
</array>
// deeplink-end
</dict>
</plist>
Please add the scheme in the Android URI Schemes interface. The SDK will automatically add the necessary XML tags to your AndroidManifest.xml.
The Android SDK relies on you to pass the configured Deeplink URL to report user re-engagement events and provide a deeplink callback. Please call SolarEngine.Analytics.handleDeepLinkUrl(url); method to pass it to the SDK.
//For Unity Editor 2020.1、2020.2、2019.4 versions
Application.deepLinkActivated += handleSchemeUrl;
//For other Unity versions
handSchemeUrl(Application.absoluteURL);
private void handleSchemeUrl(string url)
{
//Pass the URL to SDK. Please note that this step has to be done before SDK initialization
SolarEngine.Analytics.handleDeepLinkUrl(url);
}After SDK parses the Deep Linking URL, some parameters will be sent back, which you can utilize to process some business logic.
Note:
The callback function should be used before SDK initialization, otherwise the callback would fail.
Function
public static void deeplinkCompletionHandler(SESDKDeeplinkCallback callback);| Parameter | Description | Type | Required |
|---|---|---|---|
| callback | deep linking callback | SESDKDeeplinkCallback | YES |
Sample Code
private void Start()
{
Analytics.deeplinkCompletionHandler(deeplinkCallback);
//For Unity Editor 2020.1、2020.2、2019.4 versions
Application.deepLinkActivated += handleSchemeUrl1;
//For other Unity versions
handleSchemeUrl(Application.absoluteURL);
SolarEngine.Analytics.initSeSdk(AppKey, seConfig);
}
private void deeplinkCallback(int code, Dictionary data)
{
if (code == 0)
{
Debug.Log("SEUnity: deeplink callback success");
string from = (string)data["from"];
string sedpLink = (string)data["sedpLink"];
string turlId = (string)data["turlId"];
Dictionary customParams = (Dictionary)data["customParams"];
} else {
Debug.Log("SEUnity: deeplink callback fail");
}
}
private void handleSchemeUrl(string url)
{
//Pass the URL to SDK. Please note that this step has to be done before SDK initialization
SolarEngine.Analytics.handleDeepLinkUrl(url);
}Developers can conduct re-engagement attribution and business analysis by reporting successful deeplink wake-up events.
Note: If the deeplink function of the SDK is used, there is no need to call the trackAppReEngagement method.
Method:
public static void trackAppReEngagement(Dictionary customAttributes)Sample Code
Dictionary attributes = getCustomProperties();
SolarEngine.Analytics.trackAppReEngagement(attributes);