最佳答案
我在 Android Studio 中使用 Facebook-Android-sdk-4.19.0,我在 https://developers.facebook.com/docs/android/getting-started中遵循了 Facebook 的快速启动指南(点击快速启动按钮登录自己的 Facebook 帐户)。在指南中,它被告知在代码片段中复制和粘贴以下代码以跟踪应用程序日志
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsLogger;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
}
}
但是,当我在 android 工作室中复制粘贴的代码时,似乎所有的 FacebookSdk.sdkInitialize ()方法都被弃用了。这里的 https://developers.facebook.com/docs/reference/android/current/class/FacebookSdk/文档没有说明使用什么方法来初始化 sdk 而不是 sdkInitialize ()。我应该使用什么方法?