loading...

re: Android Vitals - Diving into cold start waters 🥶 VIEW POST

FULL DISCUSSION
 

Great article and thanks for the series! I'm wondering why Application subclass constructors are not one of the options for early hook. It's called earlier than Application.onCreate() or ContentProvider.onCreate(). Is it because it's not safe?

 

Great question! In the Application subclass constructor the base context of the Application instance isn't set up. That means you can't call any of the context related methods, e.g. access the app file system, etc. Probably the same level of safety as doing work on classloading, etc.

 

Thanks for reply! Does that mean storing a timestamp in memory there is ok-ish?

Yep! I'll cover that topic in more details in a follow up post ;)

code of conduct - report abuse