Deep linking integration
Bắt đầu
Deep Linking Types
- Liên kết sâu bị trì hoãn - Phục vụ các nội dung được cá nhân hóa cho những người dùng mới hoặc người dùng trước đây từng sử dụng, trực tiếp sau khi cài đặt.
- Liên kết sâu trực tiếp - Trực tiếp phục vụ các nội dung được cá nhân hóa cho những người dùng hiện có, đã cài đặt ứng dụng trên di động.
Unified deep linking (UDL) - an API which enables you to send new and existing users to a specific in-app activity as soon as the app is opened.
Để biết thêm thông tin, vui lòng xem Hướng dẫn về liên kết sâu OneLink™ và hướng dẫn dành cho nhà phát triển.
Thiết lập liên kết sâu Android
AppsFlyer SDK inspects activity intent object during onResume(). Because of that, for each activity that may be configured or launched with any non-standard launch mode please make sure to add the following code to MainActivity.java
trong tải trọng của android/app/src/main/java/com...
:
...
import android.content.Intent;
...
public class MainActivity extends ReactActivity {
...
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
}
App Links
First, you need to generate SHA256 fingerprint, then add the following intent-filter to the relevant activity in your app’s manifest:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="onelink-basic-app.onelink.me"
android:scheme="https" />
</intent-filter>
Để biết thêm về Liên kết ứng dụng, hãy xem hướng dẫn tại đây.
URI Scheme
In your app’s manifest add the following intent-filter to your relevant activity:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="mainactivity"
android:scheme="afshopapp" />
</intent-filter>
For more on URI Scheme check out the guide here.
Thiết lập liên kết sâu iOS
In order to record retargeting and use the onAppOpenAttribution/UDL callbacks in iOS, the developer needs to pass the User Activity / URL to our SDK, via the following methods in the AppDelegate.m file:
#import <RNAppsFlyer.h>
// Deep linking
// Open URI-scheme for iOS 9 and above
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *) options {
[[AppsFlyerAttribution shared] handleOpenUrl:url options:options];
return YES;
}
// Open URI-scheme for iOS 8 and below
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation {
[[AppsFlyerAttribution shared] handleOpenUrl:url sourceApplication:sourceApplication annotation:annotation];
return YES;
}
// Open Universal Links
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler {
[[AppsFlyerAttribution shared] continueUserActivity:userActivity restorationHandler:restorationHandler];
return YES;
}
Universal Links
Universal Links link between an iOS mobile app and an associate website/domain, such as AppsFlyer’s OneLink domain (xxx.onelink.me). To do so, it is required to:
- Configure OneLink sub-domain and link to mobile app (by hosting the ‘apple-app-site-association’ file - AppsFlyer takes care of this part in the onelink setup on your dashboard)
- Configure the mobile app to register approved domains:
<?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>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:test.onelink.me</string>
</array>
</dict>
</plist>
Để biết thêm về Liên kết chung, hãy xem hướng dẫn tại đây.
URI Scheme
A URI scheme is a URL that leads users directly to the mobile app.
When an app user enters a URI scheme in a browser address bar box, or clicks on a link based on a URI scheme, the app launches and the user is deep-linked.
To configure it you will have to:
- Add a unique url identifier in the URL types entry in the app's
info.plist
- Add URL Scheme as a value.
example of a URL scheme configuration in the 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>
...
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>YOUR.URL.IDENTIFIER</string>
<key>CFBundleURLSchemes</key>
<array>
<string>YOUR-URL-SCHEME</string>
</array>
</dict>
</array>
...
</dict>
</plist>
For more on URI Scheme check out the guide here.
Đã cập nhật khoảng 1 năm trước