1

Should we give the developer an option to initialize the facebook SDK by themselves later in their application? The codeless init in MarketingInitProvider is a good and convenient feature for most developers, but there are developers who want to fully control when to initialize facebook SDK as well.

Facebook SDK initialization triggers some network activities as well, which are among the things affecting application start up time. Should we offer an option then? If we do, we need to check the initialization status in a number of places as well, for example, in CurrentAccessTokenExpirationBroadcastReceiver, instead of crashing, could it just do nothing?

Lin
  • 73
  • 4

1 Answers1

1

Even with

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

and

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

HTTP calls to Facebook is still made due to MarketingInitProvider as you mentioned.

It is because the facebook-android-sdk module depends on facebook-marketing.

Explicitly exclude it in build.gradle:

implementation("com.facebook.android:facebook-android-sdk:$facebook_version") {
    exclude group: 'com.facebook.android', module: 'facebook-marketing'
}

Even with this, FB SDK still sends info to Facebook servers.

Add this to disable another auto-start provider.

    <provider
        android:name="com.facebook.internal.FacebookInitProvider"
        tools:ignore="ExportedContentProvider"
        tools:node="remove" />
Randy Sugianto 'Yuku'
  • 71,383
  • 57
  • 178
  • 228
  • Yes, I ended up removing both FacebookInitProvider and MarketingInitProvider from the Manifest. The further question I am asking for Facebook is to also be able to initialize facebook SDK by itself if it is not initialized by the developer from within a number of receivers and services: For example: CurrentAccessTokenExpirationBroadcastReceiver – Lin Apr 04 '19 at 06:19