<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="sensorLandscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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" />
<!-- Accepts URIs that begin with "memoryc://cerebrotrial” -->
<data
android:host="cerebrotrial"
android:scheme="memoryc" />
</intent-filter>
</activity>
[当我从Facebook的广告助手中测试广告时,成功发送了延迟链接。但是,当我从Facebook应用程序单击广告预览时,延迟的深层链接为null。我尝试与以下实现进行深度链接。我首先尝试从AppLinkData
获取深层链接,然后从最基本的getIntent()
实现中获取,最后通过bolts.Applinks
获得深层链接。 ApplinkData
为空,意图不返回任何内容,targetUrl
为空。
// Suggested Facebook implementation
FacebookSdk.setAutoInitEnabled(true);
FacebookSdk.fullyInitialize();
AppLinkData.fetchDeferredAppLinkData(this,
new AppLinkData.CompletionHandler() {
@Override
public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
// Process app link data
if (appLinkData != null) {
ConfigAPI.setRefererURL(appLinkData.getTargetUri().toString());
JsonObject jsonParams = ConfigAPI.getPayLoad();
new CallAPI(jsonParams).execute();
}
}
}
);
//persist deep link data
Intent intent = getIntent();
Uri data = intent.getData();
if (data != null) {
Log.i("DEEP LINK", data.toString());
ConfigAPI.setRefererURL(data.toString());
JsonObject jsonParams = ConfigAPI.getPayLoad();
new CallAPI(jsonParams).execute();
}
// using the bolts.Applinks
Uri targetUrl = AppLinks.getTargetUrlFromInboundIntent(this, getIntent());
if (targetUrl != null) {
ConfigAPI.setRefererURL(targetUrl.toString());
JsonObject jsonParams = ConfigAPI.getPayLoad();
new CallAPI(jsonParams).execute();
}