Hi everyone, I need some guidance regarding Androi...
# android
m
Hi everyone, I need some guidance regarding Android app startup performance. I’m working on a large production app (~6 million users) and currently facing slow startup time. Current setup: • In the Application.onCreate() we initialize multiple SDKs (Firebase, payment SDKs, Facebook, etc.). • In the Splash Activity, I do some initial checks to decide the next screen and also make an API call to fetch required data. Because of this, the app startup time has increased. Startup metrics (Macrobenchmark): timeToInitialDisplayMs min: 1283 ms median: 1305 ms max: 1542 ms Device: Pixel 3a (Android 12) My questions: • What are the best practices for initializing multiple SDKs without impacting startup time? • Should SDK initialization be lazy / deferred, and if yes, how do you usually decide what to defer? • Is it okay to make network calls in Splash, or should this be moved elsewhere? • What approach do you personally prefer in large-scale apps? I’d really appreciate any suggestions, patterns, or real-world experiences you can share. Thanks in advance!
not kotlin but kotlin colored 5
p
Initialize your SDK off the main thread. But do it while the Splash screen is playing a nice animation. If SDK initialization finishes super quick, don't shop the animation abruptly, let it finish. You can even select 3 animations of 500 mills each. It will pass to the next animation only if SDK initialization hasn't finished. The network call, definitely take it out of the Splash. Is it a must to start the App? Think about this question. Perhaps you really don't need it to start the App. For example, if you fetch configurations from a server. You can setup default configurations when the App starts the first time, then fetch the configurations in the background. The next time the user opens the App, second time, the updated configurations will be there. Is called one step back update technique, bc you really don't care about the first time App launch, it will be effective after the second launch
👍 2
p
Move API call in bg manger and if multiple are there then do parallel API calls.