2. TABLE OF CONTENTS
App launch time definition
The onCreate complexity
Waiting for the other shoe to drop
The good, the bad and the unzipped
Check yourself before you wreck yourself
What should you do?
3. APP LAUNCH TIME DEFINITION
There is a time frame between the app’s class’s
onCreate and the launcher activity’s onStart.
onStart
(Opening
screen seen)
App launch time
onCreate
4. This time frame can be a few milliseconds
BUT…
It can also get to as much as several seconds!
5. THE onCreate COMPLEXITY
Most SDKs aim to be placed in the
application’s onCreate to get into gear
at the earliest possible time
However, those SDKs might block the main
UI, which forces your users to wait longer
without any indication that your app is
responding…
6. WAITING FOR THE OTHER SHOE TO DROP
The longest potential task is
pre-loading data from a server
Thankfully, Android doesn’t
allow network communication
on the main UI thread
7. WAITING FOR THE OTHER SHOE TO DROP
And still, Some SDKs make sure their
data has been received from the
server by waiting for a callback before
‘releasing’ the main thread back to
the application itself.
When the amount of work done by an SDK depends on network
connection, the best thing to do is NOT to place it in the onCreate
8. When the 65K limit was an issue, SDKs were trying to
avoid it by loading additional code during Runtime
Even though the 65K issue was resolved, some
SDKs never changed the way they work
THE GOOD, THE BAD AND THE UNZIPPED
The result: a long duration of app’s start time due to the
additional code loading
9. Real-life scenario:
The app code is only
responsible for a third of its
start time!
The rest is spent on SDKs.
Why?
SDKs unzip and load dex files
dynamically when the app is
launched
The following chart displays the distribution of an app start
time by its SDKs
THE GOOD, THE BAD AND THE UNZIPPED
10. CHECK YOURSELF BEFORE YOU WRECK YOURSELF
The following chart displays the same app’s start time
distribution, this time after several usages
Why did one SDK start time
shrink while another didn’t?
Look at the difference between
the Orange SDK and the Blue one
11. CHECK YOURSELF BEFORE YOU WRECK YOURSELF
The Orange SDK first checks if it has already unzipped the file.
If so, it only loads the dex file.
However, the Blue SDK unzips the file every single time the app is loaded.
EVERY SINGLE TIME….
12. 1. Move the entire SDK’s
initialization code to a splash
screen or alike
WHAT SHOULD YOU DO?
13. SafeDK’s Marketplace is just the place
to look for the optimal SDK for you
Replace that SDK with a similar one
that offers the same functionality but
with less consequences to the user
experience.
WHAT SHOULD YOU DO?
2.
14. .
3. Not sure why it takes your app so long to
launch? Suspect it might be one of the 3rd
party tools you are using but not sure which?
Sign up for SafeDK’s In-App Protection and
get SDK-oriented live data and real time
alerts for any increase in SDK start time or
other issues.
WHAT SHOULD YOU DO?