FacebookSdk.sdkInitialize - 调用一次,或每次调用一次?

时间:2017-05-21 20:06:33

标签: android facebook

我是否需要在每项活动中加入FacebookSdk.sdkInitialize(getApplicationContext());?或者只是第一个活动?

1 个答案:

答案 0 :(得分:1)

他们要求在Application类onCreate()方法中初始化它。

public class MyApplication extends Application {
// Updated your class body:

@Override
public void onCreate() {
    super.onCreate();
    // Initialize the SDK before executing any other operations,
    FacebookSdk.sdkInitialize(getApplicationContext());
    AppEventsLogger.activateApp(this);
}

Link to the original answer