获取最近的深度链接
public static void getLastDeeplink(final Context context, final OnLastDeeplinkReadListener onLastDeeplinkReadListener)
您可以通过调用 Adjust.getLastDeeplink() 方法,返回发送至 Adjust.processDeeplink() 或 Adjust.processAndResolveDeepLink()方法 的最近一个深度链接 URL。此方法会以 URL 的形式返回最近的深度链接。
Adjust.getLastDeeplink(context) { deeplink ->
Log.d("Example", deeplink.toString())
Adjust.getLastDeeplink(context, new OnLastDeeplinkReadListener() {
public void onLastDeeplinkRead(Uri deeplink) {
Log.d("Example", deeplink.toString());
链接解析
public static void resolveLink(final String url,
final String[] resolveUrlSuffixArray,
final AdjustLinkResolutionCallback adjustLinkResolutionCallback)
有的电子邮件服务提供商 (ESP) 会针对营销推广活动使用自有的自定义域名。如果您需要通过自定义域名监测点击,就要设置 SDK 以解析链接。为此,请调用 AdjustLinkResolution 类的 resolveLink 方法。此时,Adjust SDK 就会跟随自定义链接,在打开深度链接时进行解析。这样,您就能记录用户与电子邮件推广活动的互动了。
resolveLinkWithUrl 方法使用下列参数:
url (String):打开应用的深度链接。
resolveUrlSuffixArray (String[]):需要解析的、已设置推广活动的自定义域名。
adjustLinkResolutionCallback (AdjustLinkResolutionCallback):返回最终 URL 的回传。
该方法会比对深度链接和 resolveUrlSuffixArray中的域。如果找不到任何匹配,就会按原样转发深度链接 URL。如果找到了匹配,就会尝试解析链接并返回得出的深度链接,然后将其保存在回传参数中。
此时,您就可以使用返回的深度链接进行用户再归因了。为此,请将深度链接传递至 Adjust.processDeeplink 方法。
AdjustLinkResolution.resolveLink(url, arrayOf("example.com"), object : AdjustLinkResolution.AdjustLinkResolutionCallback {
override fun resolvedLinkCallback(resolvedLink: Uri) {
val adjustDeeplink = AdjustDeeplink(resolvedLink)
Adjust.processDeeplink(adjustDeeplink, applicationContext)
AdjustLinkResolution.resolveLink(url, new String[]{"example.com"}, new AdjustLinkResolution.AdjustLinkResolutionCallback() {
public void resolvedLinkCallback(Uri resolvedLink) {
AdjustDeeplink adjustDeeplink = new AdjustDeeplink(resolvedLink);
Adjust.processDeeplink(adjustDeeplink, getApplicationContext());
处理带有 referrer 的深度链接
可选 referrer URL,用于跟踪深度链接或应用打开的来源,以优化归因或再归因和深度链接。例如,对于 SEO / 自然搜索等渠道,Adjust 链接不会直接被使用。如果客户的根域已部署 Android 应用链接,并触发了应用打开,那么对于此类渠道来说,我们可能必须通过 referrer URL 传入的信号开展用户归因或再归因。
设置 referrer URL
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val adjustDeeplink = AdjustDeeplink(data)
// If referrer URL is available, add it to the deeplink object
val referrer = getReferrer() //Activity#getReferrer()
adjustDeeplink.setReferrer(referrer)
Adjust.processDeeplink(adjustDeeplink, applicationContext)
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = getIntent();
Uri data = intent.getData();
AdjustDeeplink adjustDeeplink = new AdjustDeeplink(data);
// If referrer URL is available, add it to the deeplink object
Uri referrer = getReferrer(); //Activity#getReferrer()
adjustDeeplink.setReferrer(referrer);
Adjust.processDeeplink(adjustDeeplink, getApplicationContext());