3

I'm using Facebook SDK for Android v4.20. When I want to call AppEventsLogger.deactivateApp(getApplication()); in my Activity's onPause() it shows as deprecated. I'm using Android Studio 2.3, the app minimum SDK is 16 and target is 25, I use build tools v25.0.2.

It seems to be similar to this SO question but the solution doesn't work and Android Studio is still showing this method as deprecated.

enter image description here

What might be the reason of this warning?

Community
  • 1
  • 1
Jan Slominski
  • 2,968
  • 4
  • 35
  • 61

3 Answers3

7

I ran into the same issue. The documentation provided on Facebook does not mention anything about this(AFAIC), however, I noticed that the following message was logged out on LogCat:

W/com.facebook.appevents.AppEventsLogger: deactivateApp events are being logged automatically. There's no need to call deactivateApp, this is safe to remove.

That being said, I'm assuming that there is no longer need for the method .deactivateApp();

Hope it helps :)

gmartinsnull
  • 1,075
  • 1
  • 12
  • 11
1

The AppEventsLogger.activateApp() method invocation point has also been changed.

https://developers.facebook.com/docs/reference/android/current/class/AppEventsLogger/

PathoS
  • 439
  • 4
  • 9
0

activateApp(Application application): Notifies the events system that the app has launched and activate and deactivate events should start being logged automatically.

activateApp(Context context): Deprecated. Use activateApp(Application) -- the above call.

deactivateApp(Context context, java.lang.String applicationId): Deprecated. When using activateApp(Application) deactivate app will be logged automatically.

source: https://developers.facebook.com/docs/reference/androidsdk/current/facebook/com/facebook/appevents/appeventslogger.html/

Keita
  • 335
  • 2
  • 3