android – How to opt out from Facebook SDK event logging?-ThrowExceptions

Exception or error:

I’m using Facebook App Events tracking for Android, but I have no idea how to disable tracking when a user wants to opt out! Does anyone know how to do that?

The documentation says:

We recommend that you use our SDK tools to offer the opt-out.

But they don’t actually describe it anywhere. Classic Facebook move.

EDIT:
Now with the GDPR being in effect for so long, they still don’t have any way to disable all tracking until the user consents, do they?

How to solve:

Don’t know about per User, but you can opt put from Facebook SDK event logging:

Add this int your Android.Manifest.xml:

<meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
            android:value="false"/>

###

After the documentation was updated it seems the new way to go is a combination of disabling

<meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
        android:value="false"/>
<meta-data android:name="com.facebook.sdk.AdvertiserIDCollectionEnabled"
        android:value="false"/>
<meta-data android:name="com.facebook.sdk.AutoInitEnabled"
        android:value="false"/> <!--OPTIONAL-->

And at runtime to opt in call:

FacebookSDK.setAdvertiserIDCollectionEnabled(true)
FacebookSDK.setAdvertiserIDCollectionEnabled(true)
// OPTIONALLY the following two lines if AutoInitEnabled is set to false in manifest:
FacebookSDK.setAutoInitEnabled(true)
FacebookSDK.fullyInitialize()

Right now I don’t see when it would be good to disable (and later enable) auto init, maybe someone else might have an idea here.

###

The opt-out they are talking about is described in the heading below: https://developers.facebook.com/docs/app-events/android#setlimiteventusage

You can call AppEventsLogger.setLimitEventUsage(this, true); to “opt-out” (at least limit) how the events logged are used.

Leave a Reply

Your email address will not be published. Required fields are marked *