The Android Facebook SDK is always making a network request to
So if we're initializing it in the
What we're doing now is calling
from Prevent network requests from Facebook Android SDK
graph.facebook.com
when calling FacebookSdk.sdkInitialize(context)
even if nothing of the SDK has been used yet.So if we're initializing it in the
Application.onCreate()
there will always be at least one network request. Even if the setting is as follows: <meta-data
android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
android:value="false" />
We've took a closer look at this because a user complained that he is not using the Facebook Login (which is why we have the Facebook SDK in the first place) and still there is "user data" transferred to Facebook. In times of GDPR and suspicious users, this is a very unfavourable behaviour!What we're doing now is calling
FacebookSdk.sdkInitialize(context)
only when the user wants to use the Facebook Login (at the time when the user clicks on the button). Additionally, we removed the meta-data
for android:name="com.facebook.sdk.ApplicationId"
from the AndroidManifest
. This prevents the initial network request but then there is the following crash appearing in the CurrentAccessTokenExpirationBroadcastReceiver
:java.lang.RuntimeException: Unable to start receiver com.facebook.
CurrentAccessTokenExpirationBroadcastReceiver: The SDK has not been initialized,
make sure to call FacebookSdk.sdkInitialize() first.
at com.facebook.internal.Validate.sdkInitialized(Validate.java:143)
at com.facebook.FacebookSdk.getApplicationContext(FacebookSdk.java:518)
at com.facebook.AccessTokenManager.getInstance(AccessTokenManager.java:86)
at com.facebook.CurrentAccessTokenExpirationBroadcastReceiver.onReceive(
CurrentAccessTokenExpirationBroadcastReceiver.java:34)
Now there are several questions:-
Why is Facebook still making a request at start? If they want to validate the auth token, they can do it as soon as the SDK is really used...
-
Does Facebook know and tolerate crashes when
sdkInitialize()
is not called? Because I fear when thisNullPointerException
is removed there will be other crashes...
-
Most important: Are there any other ways to prevent network requests from the Facebook SDK when its features are not used?
from Prevent network requests from Facebook Android SDK
No comments:
Post a Comment