Facebook Audience Network Ads integration Issue

2020-08-13 05:45发布

问题:

E/FBAudienceNetwork: You are using custom Application class and don't call AudienceNetworkAds.isInAdsProcess(). Multi-process support will be disabled. Please call AudienceNetworkAds.isInAdsProcess() if you want to support multi-process mode.

implementation 'com.facebook.android:audience-network-sdk:5.1.0'
implementation 'com.mopub.mediation:facebookaudiencenetwork:5.1.0.2'

am using FAN along with Mopub.

How to fix the above issue? Thanks in advance.

回答1:

It's likely because you use custom Application subclass. Put AudienceNetworkAds.isInAdsProcess() call on top of your custom Application class like this:

public class YourApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        if (AudienceNetworkAds.isInAdsProcess(this)) {
            return;
        }

        // your normal onCreate() code
    }
}

Now warning should disappear.

Alternatively you can turn multiprocess support off (not recommended) by setting:

AdSettings.setMultiprocessSupportMode(MultiprocessSupportMode.MULTIPROCESS_SUPPORT_MODE_OFF);

Note. You should call this before calling SDK methods or MoPub mediation.



回答2:

If you are using Facebook Audience Network then, Must be implement both latest sdk in your dependencies then you can call all callback of facebook sdk( check this link- https://developers.facebook.com/docs/audience-network/guides/adding-sdk/android )

Here you forget to add (support annotation dependencies).

In Android Studio, make sure that mavenCentral() or jcenter() is included in your project's list of repositories. Repositories are defined in your project's module-level build.gradle file.

repositories {
    mavenCentral()
    jcenter()
}

Next, add the following implementation dependencies to your project's list of dependencies. Dependencies are also defined in your project's module-level build.gradle file. Note that annotation support is required by the Audience Network SDK.

dependencies { 
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'com.facebook.android:audience-network-sdk:5.+'
}

HAPPY CODING :)