Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FacebookSdk.sdkInitialize(getApplicationContext()) Deprecated

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.

like image 246
AndroidBeginner Avatar asked Jan 27 '17 22:01

AndroidBeginner


Video Answer


2 Answers

Simply do not write this line of code in your class

FacebookSdk.sdkInitialize(getApplicationContext());
like image 141
Ali Ashraf Avatar answered Oct 16 '22 05:10

Ali Ashraf


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.

like image 34
AndroidBeginner Avatar answered Oct 16 '22 03:10

AndroidBeginner