12

I'm integrating facebook SDK in my app as an option to login for the users. But recently I have started getting FacebookSdk.sdkInitialize(getApplicationContext()) as Deprecated

   @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        FacebookSdk.sdkInitialize(getApplicationContext());
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolBar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);

So after hustling for long I was able to find the solution to this.

Garg
  • 2,731
  • 2
  • 36
  • 47
AndroidBeginner
  • 663
  • 1
  • 9
  • 16
  • 1
    http://stackoverflow.com/questions/41884349/facebooksdk-sdkinitialize-context-is-deprecated/41884415#41884415 – Yupi Jan 27 '17 at 23:31

2 Answers2

13

So according to the latest facebook documentation we now don't need to initialize the facebook SDK and it automatically gets invoked. So now FacebookSdk.sdkInitialize(getApplicationContext()) can be deleted.

AndroidBeginner
  • 663
  • 1
  • 9
  • 16
3

Simply do not write this line of code in your class

FacebookSdk.sdkInitialize(getApplicationContext());
Ali Ashraf
  • 31
  • 3