Branch.io深层链接onLinkCreate从未调用过

时间:2016-09-16 08:19:15

标签: android branch.io

似乎无法让Branch.io调用onLinkCreate方法。

将文档复制/粘贴到按下按钮调出的方法。 这是方法:

public void shareBuilding(View v){
    Log.i("DEEP_LINK", "Composing deep link...");
    BranchUniversalObject branchUniversalObject = new BranchUniversalObject()
            .setCanonicalIdentifier("item/12345")
            .setTitle("My Content Title")
            .setContentDescription("My Content Description")
            .setContentImageUrl("https://example.com/mycontent-12345.png")
            .setContentIndexingMode(BranchUniversalObject.CONTENT_INDEX_MODE.PUBLIC)
            .addContentMetadata("property1", "blue")
            .addContentMetadata("property2", "red");

    Log.i("DEEP_LINK", "BranchUniversalObject created");
    LinkProperties linkProperties = new LinkProperties()
            .setChannel("unk")
            .setFeature("sharing")
            .addControlParameter("$desktop_url", "http://www.example.com")
            .addControlParameter("$ios_url", "http://www.example.com");

    Log.i("DEEP_LINK", "LinkProperties created");
    branchUniversalObject.generateShortUrl(this, linkProperties, new Branch.BranchLinkCreateListener() {
        @Override
        public void onLinkCreate(String url, BranchError error) {
            if (error == null) {
                Log.i("DEEP_LINK", "Deep link composed: " + url);
            }else{
                Log.i("DEEP_LINK", "Error composing deep link: " + error.toString());
            }
        }
    });

这完全来自文档,但永远不会调用onLinkCreate方法。

这是android监视器输出:

DEEP_LINK: Composing deep link...
DEEP_LINK: BranchUniversalObject created
DEEP_LINK: LinkProperties created
永远不会调用

onLinkCreate。不会抛出任何错误消息。 我似乎遇到了使用Branch.io方法的墙(从生成此链接到打开深度链接的意图)所以我担心可能会有一些我遗漏或完全错误的事情。

这是我的AndroidManifest.xml内容:

 <!-- This is for Branch,io deep linking -->
    <meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_xxxxxxxxxxxxxxxx" />
    <receiver android:name="io.branch.referral.InstallListener" android:exported="true">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>

    <activity
        android:name=".activity.Landing"
        android:label="@string/title_activity_maps"
        android:screenOrientation="portrait">

        <!-- This is for brach.io deep linking-->
        <intent-filter>
            <data android:scheme="foo" android:host="open" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>
    </activity>

我错过了什么?

谢谢!

0 个答案:

没有答案