42

Using Facebook SDK 4.5. Tried using SDK 4.5 to 4.11. Problem still facing.

AS per this changelog : https://developers.facebook.com/docs/android/change-log-4.x

Its changed to AppEventsLogger.activateApp(Application)

But I am facing trouble while implementing it.

Screenshot:

Termininja
  • 5,689
  • 12
  • 40
  • 45
Ashish Dung Dung
  • 543
  • 1
  • 5
  • 10

1 Answers1

97

Just replace AppEventsLogger.activateApp(this) to

AppEventsLogger.activateApp(getApplication());
Strider
  • 4,044
  • 3
  • 18
  • 32
KRist
  • 1,334
  • 10
  • 9
  • Thank you so much, it worked. :) I came to know about it after i went through the latest sdk change logs. However Facebook should at least update their logs in a better way. – Ashish Dung Dung May 17 '16 at 13:13
  • 2
    @Ashish they have 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. – edwinj Jun 17 '16 at 18:32
  • Yes, I had noticed that later on, thanks for your answer, though, appreciate it :)! – Ashish Dung Dung Jun 18 '16 at 18:50
  • but then onPause deactivateApp() is deprecated – Alex Mar 07 '17 at 21:07
  • activateApp() is deprecated – AllwiN Feb 08 '21 at 06:12