我已经为用户创建了一个动态链接,可以在我的应用中分享一些内容.
当我href在Android设备上使用标记单击HTML页面中的链接时,该链接正在运行.
这意味着,如果未安装该应用程序,请转到Play商店,否则打开应用程序即可收到深层链接地址.
但是当链接在Facebook信使或电子邮件等其他地方完全相同时,我点击链接,然后它就无法正常工作.
即使我的应用已安装,它也始终会重定向到Play商店.
有什么问题?
我的代码在这里.
.java用于接收深层链接
GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, this)
.addApi(AppInvite.API)
.build();
boolean autoLaunchDeepLink = false;
AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, autoLaunchDeepLink)
.setResultCallback(
new ResultCallback<AppInviteInvitationResult>() {
@Override
public void onResult(@NonNull AppInviteInvitationResult result) {
if (result.getStatus().isSuccess()) {
// Extract deep link from Intent
Intent intent = result.getInvitationIntent();
String deepLink = AppInviteReferral.getDeepLink(intent);
Log.e("sf", "### deep link : " + deepLink );
} else {
Log.d("asdf", "getInvitation: no deep link found.");
}
}
});
Run Code Online (Sandbox Code Playgroud)AndroidManifest.xml中活动的意图部分
<intent-filter>
<action android:name="android.intent.action.VIEW" /> …Run Code Online (Sandbox Code Playgroud)