App Slowing down for no reason on resuming activity multiple times..

Abhay Kaushal
2 min readApr 30, 2021

As an Android developer you are aware of problems like activity lagging, low fps while scrolling on app’s activity/fragment.

You usually do things like fixing memory leaks,optimzing your XML layouts,etc for saving heap memory of your app.If you have done all these things and still your app is not smooth then :

Observe you app dependencies inside build.gradle

implementation 'com.facebook.android:facebook-core:9.0.0'
implementation 'com.facebook.android:facebook-login:9.0.0'
implementation 'com.facebook.android:facebook-share:9.0.0'
implementation 'com.facebook.android:audience-network-sdk:6.3.0'
implementation 'com.google.ads.mediation:facebook:6.3.0.1'
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'

If you are using facebook SDK then after all you efforts of optimizing your app then most likely the reason now for your app’s slow performance is the “FACEBOOK SDK”

From Facebook developers website they said

When you use the Facebook SDK, certain events in your app are automatically logged and collected for Facebook Analytics unless you disable automatic event logging. These events are relevant for all use cases — targeting, measurement and optimization. There are three key events collected as part of the Automatic App Event Logging: App Install, App Launch, and Purchase. When automatic logging is enabled, advertisers are able to disable these events, as well as other Facebook internal events such as login impression events. However, if you have disabled automatic logging, but still want to log specific events, such as install or purchase events, manually implement logging for these events in your app.

And these event logging are heavy so what you need to do is disable logging , to disable logging you have to add a line in AndroidManifest.xml

<meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
android:value="false"
/>

Now build and run your app ,you will see a drastic improvement in the performance of app.

HAPPY CODING..

--

--