Android上的Facebook SDK和DeferredAppLinks问题(2019年12月)

时间:2019-12-26 21:01:43

标签: java android facebook facebook-graph-api sdk

我在使用Facebook SDK和DeferredAppLinks时遇到问题。

我从Facebook测试工具发送测试延迟的链接,从这里-https://developers.facebook.com/tools/app-ads-helper/?id=5xxxxxxxxxxxx作为带有app:// abc?a = b之类的参数的url,然后安装使用发布密钥签名的应用,并通过调试启动它模式,没有任何链接来自Facebook SK库,只有null来自方法fetchDeferredAppLinkData(Context,CompletionHandler)(https://developers.facebook.com/docs/reference/android/current/class/AppLinkData/#fetchDeferredAppLinkData),几个月前,使用相同代码都可以。

Manifest.xml-

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="net.xxx.xxxxx">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SET_WALLPAPER" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Botty.Theme"
        android:usesCleartextTraffic="true"
        android:largeHeap="true"
        tools:ignore="ManifestResource">
        <activity
            android:name=".SplashActivity"
            android:label="@string/app_name"
            android:theme="@style/IntroTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter android:label="Filter">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="http" android:host="net.xxx.xxxx"/>
                <data android:scheme="app" android:host="net.xxx.xxxx" />
                <data android:scheme="https" android:host="net.xxx.xxxx" />
                <data android:scheme="https" android:host="net.xxx.xxxx" />
                <data android:scheme="net.xxx.xxxx" android:host="creative_id" />
            </intent-filter>

            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/shortcuts" />
        </activity>

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

        <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />
        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">
            <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:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>
    </application>

</manifest>

然后我尝试在我的SplashActivity上捕获网址-

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.setAutoInitEnabled(true);
FacebookSdk.fullyInitialize();
FacebookSdk.setAutoLogAppEventsEnabled(true);


AppLinkData.fetchDeferredAppLinkData(this, new AppLinkData.CompletionHandler() {
    public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
        // here appLinkData comes always as null and it makes me crazy!
    }
});}

请帮助我,否则可能是最新的facebook SDK问题?

我使用实现     'com.facebook.android:facebook-android-sdk:[5,6)'

在具有Android 10,Android 7和模拟器的设备上的Facebook应用程序中,在具有开发者帐户的设备上进行测试。

0 个答案:

没有答案