androidfacebookfacebook-sdk-3.0facebook-sdk-4.xfacebook-sdk-3.14.x

Facebook SDK Initialization for SDK v3.23.1 to implement App Events for Android


I am trying to follow the instructions at https://developers.facebook.com/docs/app-events/android#legacy-activation in the section "Legacy SDK Initialization". They say that "in the Facebook SDK for Android v4.18, and earlier, the SDK must be initialized". I am using Facebook SDK v3.23.1. They provide a code to demonstrate how to initialize the SDK. The problem that I am experiencing is that as part of the sample code, they use the following two lines:

import com.facebook.FacebookSdk;
FacebookSdk.sdkInitialize(getApplicationContext());

When I try to do that, I get the following error:

Cannot resolve symbol 'FacebookSdk'

By testing, I realized that import com.facebook.FacebookSdk can only be used from Facebook SDK 4.0.0 and higher, but I am using Facebook SDK 3.23.1. Is there an alternative way to initialize Facebook SDK for SDK v3.23.1?


Solution

  • The solution was using the AppEventsLogger class by following the instructions at https://developers.facebook.com/docs/reference/android/3.23.1/class/AppEventsLogger/. I did not have to initialize Facebook SDK v3.23.1, and I guess it is not even possible to initialize it because they do not provide a method to do that in the SDK 3.23.1 release.