Android Firebase动态链接始终返回状态已取消

时间:2016-10-25 20:54:38

标签: android firebase firebase-dynamic-links

我在Android中实现Firebase动态链接时遇到了很大的问题。

我完全遵循了这条指令: https://firebase.google.com/docs/dynamic-links/android

My Manifest是正确的,我的firebase项目包含正确的sha1键。

如果我通过ADB触发,我的目标意图是打开,但AppInviteInvitationResult的状态始终为CANCELED。

我尝试了一切,无法找到任何解决方案......

我的代码看起来像这样:

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()) {
                        Intent intent = result.getInvitationIntent();
                        String deepLink = AppInviteReferral.getDeepLink(intent);
                        // MY CODE
                    }
                }
            });

调用onResult,但状态始终为CANCELED!

Manifest看起来像这样:

 <activity
        android:name="appsoluts.kuendigung.ActivityDeepLink"
        android:theme="@style/AppTheme.NoActionBar"
        android:screenOrientation="portrait"
        android:parentActivityName="appsoluts.kuendigung.ActivityMain"
        android:launchMode="singleTop"
        android:configChanges="orientation|screenSize"
        android:windowSoftInputMode="stateHidden|adjustResize">

        <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="kuendigung.org" android:scheme="http"/>
            <data android:host="kuendigung.org" android:scheme="https"/>
        </intent-filter>
        <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="bien-resilier.fr" android:scheme="http"/>
            <data android:host="bien-resilier.fr" android:scheme="https"/>
        </intent-filter>

        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="appsoluts.kuendigung.ActivityMain" />

    </activity>

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

您还应该将密钥的SHA256添加到firebase面板中的Android应用配置中。

相关问题