Facebook 延迟深度链接不起作用
Facebook deferred deep linking not working
如果用户在 Facebook 应用程序中点击深度 link 时未安装我的应用程序,我如何获取应用程序 link 数据?令人惊讶的是,facebook 关于这个问题的文档很少。这是 deep link class 的清单内容。
<activity
android:name=".ui.activities.ViewProductSimple"
android:label="Clicky Online Shopping App"
android:launchMode="singleTask"
android:screenOrientation="portrait" >
<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="www.clicky.pk" android:scheme="http"/>
<data android:host="www.clicky.pk" android:scheme="https"/>
</intent-filter>
</activity>
This is my deep link:
https://www.clicky.pk/index.php/dispatch=products.view%26product_id=268522
这就是 ViewProductSimple class 从哪里得到更深的 link。
FacebookSdk.sdkInitialize(getApplicationContext());
Uri targetUrl = AppLinks.getTargetUrlFromInboundIntent(this, getIntent());
if (targetUrl != null)
{
Log.i("Activity", "App Link Target URL: " + targetUrl.toString());
Toast.makeText(this, targetUrl.toString(), Toast.LENGTH_SHORT).show();
String scheme = targetUrl.getQueryParameter("dispatch");
String id = scheme.substring(25);
productId = Integer.parseInt(id);
getProductFromServer();
}
问题是,当我通过 "App Ads Helper" 发送 deep link 时,我在 Facebook 收到通知,如果安装了应用程序,它会完美运行,但如果未安装应用程序,它会带我去玩商店,并在安装后只需打开 MainActivity。
谁能帮帮我?我被困在深处 link 的某个地方,我想通过深度 linking 提示我的应用程序。任何代码或示例将不胜感激。
你需要在launchActivity(MainActivity)中获取FacebookDeeplink的数据,这与你在ViewProductSimple中获取数据的方式相同。
因为随后用户会安装您的应用并打开您的应用,Facebook 深层链接将被发送到 MainActivity(启动 activity)。
如果用户在 Facebook 应用程序中点击深度 link 时未安装我的应用程序,我如何获取应用程序 link 数据?令人惊讶的是,facebook 关于这个问题的文档很少。这是 deep link class 的清单内容。
<activity
android:name=".ui.activities.ViewProductSimple"
android:label="Clicky Online Shopping App"
android:launchMode="singleTask"
android:screenOrientation="portrait" >
<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="www.clicky.pk" android:scheme="http"/>
<data android:host="www.clicky.pk" android:scheme="https"/>
</intent-filter>
</activity>
This is my deep link: https://www.clicky.pk/index.php/dispatch=products.view%26product_id=268522
这就是 ViewProductSimple class 从哪里得到更深的 link。
FacebookSdk.sdkInitialize(getApplicationContext());
Uri targetUrl = AppLinks.getTargetUrlFromInboundIntent(this, getIntent());
if (targetUrl != null)
{
Log.i("Activity", "App Link Target URL: " + targetUrl.toString());
Toast.makeText(this, targetUrl.toString(), Toast.LENGTH_SHORT).show();
String scheme = targetUrl.getQueryParameter("dispatch");
String id = scheme.substring(25);
productId = Integer.parseInt(id);
getProductFromServer();
}
问题是,当我通过 "App Ads Helper" 发送 deep link 时,我在 Facebook 收到通知,如果安装了应用程序,它会完美运行,但如果未安装应用程序,它会带我去玩商店,并在安装后只需打开 MainActivity。 谁能帮帮我?我被困在深处 link 的某个地方,我想通过深度 linking 提示我的应用程序。任何代码或示例将不胜感激。
你需要在launchActivity(MainActivity)中获取FacebookDeeplink的数据,这与你在ViewProductSimple中获取数据的方式相同。 因为随后用户会安装您的应用并打开您的应用,Facebook 深层链接将被发送到 MainActivity(启动 activity)。