Fix When adding Facebook SDK “ appeventslogger.activateapp(this)” is shown deprecated

Disclaimer: This article represents the situational errors faced by myself and solutions regarding them with help and articles from around the internet.

When I used Facebook SDK 4.11+. I faced  appeventslogger.activateapp(this) is shown deprecated error.

Gradually, Facebook had changed many things with its SDK coming from v4.5.

I faced this problem while implementing Facebook SDK on an Android project in Android Studio.

The version of Android Studio that I was using was 2.0 Stable Build.

The reason for facing this error: Various Changes to Facebook SDK itself and is covered under change log and implementations.

If you are facing this same problem while implementing the Facebook SDK, you can follow the tutorials in this article.

However, they didn’t update their walkthroughs in a better way, though.

The changelog : https://developers.facebook.com/docs/android/change-log-4.x

It’s changed to AppEventsLogger.activateApp(Application).

But I was facing trouble while implementing it. You can see the screenshot below.

AppEventsLogger.activateApp(this),

However thanks for dedicated people in StackOverflow, they helped me regarding this by informing what to change.

Just replace

AppEventsLogger.activateApp(this)

to

AppEventsLogger.activateApp(getApplication());

I came to know about it after I went through the latest SDK change logs very thoroughly. However, Facebook should at have at least update their change logs in a better way.

They had changed it.

Before they asked you to put that code before setContentView() of your Activity where “this” would be Activity, now they ask you to put in in your Application class where “this” would be Application.

The Original Question was posted here by Myself On Stackoverflow- http://bit.ly/2de0ZNe

If you are facing any problems while implementing Facebook SDK on your android project in the Android Studio, you can ask about it in comments below.

Leave a Reply

2 Comments on "Fix When adding Facebook SDK “ appeventslogger.activateapp(this)” is shown deprecated"

Notify of
avatar
Sort by:   newest | oldest | most voted
pratibha
Guest

This doesnt work

wpDiscuz