Jan Slominski
Jan Slominski

Reputation: 2978

AppEventsLogger.deactivateApp(Context context) deprecated

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?

Upvotes: 3

Views: 2776

Answers (3)

Keita
Keita

Reputation: 349

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/

Upvotes: 0

PathoS
PathoS

Reputation: 459

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

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

Upvotes: 1

gmartinsnull
gmartinsnull

Reputation: 1153

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 :)

Upvotes: 7

Related Questions