<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/24-28-code-runs-before-your-application-oncreate-here-s-what-5ze1roro5" -->

---
title: 24/28: Code Runs Before Your Application.onCreate:...
description: Code from libraries like Firebase and Jetpack App Startup runs before your Application.onCreate by exploiting Android's ContentProvider lifecycle: the system...
canonical: https://daily.dev/posts/24-28-code-runs-before-your-application-oncreate-here-s-what-5ze1roro5
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: 24/28: Code Runs Before Your Application.onCreate: Here’s What | daily.dev
og:description: Code from libraries like Firebase and Jetpack App Startup runs before your Application.onCreate by exploiting Android's ContentProvider lifecycle: the system...
og:url: https://daily.dev/posts/24-28-code-runs-before-your-application-oncreate-here-s-what-5ze1roro5
og:image: https://api.daily.dev/og/posts/5ze1rOro5.png
og:image:alt: 24/28: Code Runs Before Your Application.onCreate: Here’s What
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 24/28: Code Runs Before Your Application.onCreate: Here’s What

**[Medium](https://daily.dev/sources/medium_js)** · 6 min read · 0 upvotes · 0 comments

## Summary

Code from libraries like Firebase and Jetpack App Startup runs before your Application.onCreate by exploiting Android's ContentProvider lifecycle: the system calls installContentProviders() before callApplicationOnCreate() in ActivityThread.handleBindApplication. Libraries ship a tiny ContentProvider that hooks into this ordering to auto-initialize themselves without you ever calling init(), which adds a hidden cold-start cost. The piece walks through how Jetpack App Startup's InitializationProvider and Firebase's FirebaseInitProvider work, why this padding is invisible in your own source, and how to audit your merged manifest, profile the provider-install phase with a trace, and remove or defer eager init to reclaim cold-start time.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/@promode7/24-28-code-runs-before-your-application-oncreate-heres-what-613d9208a02d>

## Questions this post answers

### Why does my Android app already have Firebase initialized before Application.onCreate runs, even though I never called FirebaseApp.initializeApp()?

Firebase ships a ContentProvider called FirebaseInitProvider in its manifest, and Android calls every declared provider's onCreate() before calling your Application.onCreate(), inside ActivityThread.handleBindApplication via installContentProviders(). Because the provider's onCreate runs first, FirebaseApp gets initialized automatically without any explicit call from your code.

_daily.dev surfaces deep dives like this for developers debugging unexplained Android cold-start costs._

### How can I stop a library's Jetpack App Startup initializer from running automatically and instead run it lazily?

Remove the library's auto-init ContentProvider entry using tools:node="remove" on its meta-data tag or the provider declaration in your manifest, then call the Initializer's create() method yourself on a background thread when you actually need it. This avoids paying the cold-start cost of eager initialization for libraries you don't need running at process start.

_Android developers tuning cold-start budgets can find practical fixes like this via daily.dev._

### Why does provider onCreate run before Application.onCreate on Android and how does that affect cold start performance?

In ActivityThread.handleBindApplication, installContentProviders() is called before callApplicationOnCreate(), so every manifest-declared ContentProvider's onCreate executes first. Since this happens on the critical path to the first frame, any provider that touches disk, crypto, or a database in onCreate adds cold-start latency invisible in the app's own Application.onCreate code, appearing only in a system trace of the provider-install phase.

_daily.dev helps engineers chasing cold-start regressions track ordering quirks like this one._

## Similar posts on daily.dev

- [8/28: What Really Happens When You Tap Your App Icon](https://daily.dev/posts/8-28-what-really-happens-when-you-tap-your-app-icon-nlc3doh6o) · Medium · 1 upvotes · 0 comments
- [Android Internals: What Really Happens Under the Hood When You Tap on App Icon?](https://daily.dev/posts/android-internals-what-really-happens-under-the-hood-when-you-tap-on-app-icon--f0ohazgqw) · ProAndroidDev · 0 upvotes · 0 comments
- [Android Developers Blog: Deeper Performance Considerations](https://daily.dev/posts/android-developers-blog-deeper-performance-considerations-qsbtzemol) · Android Developers Blog · 1 upvotes · 0 comments
- [Fully Optimized: Wrapping up Performance Spotlight Week](https://daily.dev/posts/fully-optimized-wrapping-up-performance-spotlight-week-h5xryptkz) · Android Developers Blog · 1 upvotes · 0 comments

---

Tags: [#performance](https://daily.dev/tags/performance), [#android](https://daily.dev/tags/android), [#firebase](https://daily.dev/tags/firebase)

[View this post on daily.dev](https://daily.dev/posts/24-28-code-runs-before-your-application-oncreate-here-s-what-5ze1roro5)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"24/28: Code Runs Before Your Application.onCreate: Here’s What","url":"https://daily.dev/posts/24-28-code-runs-before-your-application-oncreate-here-s-what-5ze1roro5","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/24-28-code-runs-before-your-application-oncreate-here-s-what-5ze1roro5"},"datePublished":"2026-09-10T01:05:14.083Z","dateModified":"2026-09-10T01:18:34.537Z","description":"Code from libraries like Firebase and Jetpack App Startup runs before your Application.onCreate by exploiting Android's ContentProvider lifecycle: the system...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/027bc1ff0082460256adc70f1d47ce4f?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/027bc1ff0082460256adc70f1d47ce4f?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/24-28-code-runs-before-your-application-oncreate-here-s-what-5ze1roro5","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"performance,android,firebase","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"24/28: Code Runs Before Your Application.onCreate: Here’s What"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/24-28-code-runs-before-your-application-oncreate-here-s-what-5ze1roro5#faq","mainEntity":[{"@type":"Question","name":"Why does my Android app already have Firebase initialized before Application.onCreate runs, even though I never called FirebaseApp.initializeApp()?","acceptedAnswer":{"@type":"Answer","text":"Firebase ships a ContentProvider called FirebaseInitProvider in its manifest, and Android calls every declared provider's onCreate() before calling your Application.onCreate(), inside ActivityThread.handleBindApplication via installContentProviders(). Because the provider's onCreate runs first, FirebaseApp gets initialized automatically without any explicit call from your code. daily.dev surfaces deep dives like this for developers debugging unexplained Android cold-start costs."}},{"@type":"Question","name":"How can I stop a library's Jetpack App Startup initializer from running automatically and instead run it lazily?","acceptedAnswer":{"@type":"Answer","text":"Remove the library's auto-init ContentProvider entry using tools:node=\"remove\" on its meta-data tag or the provider declaration in your manifest, then call the Initializer's create() method yourself on a background thread when you actually need it. This avoids paying the cold-start cost of eager initialization for libraries you don't need running at process start. Android developers tuning cold-start budgets can find practical fixes like this via daily.dev."}},{"@type":"Question","name":"Why does provider onCreate run before Application.onCreate on Android and how does that affect cold start performance?","acceptedAnswer":{"@type":"Answer","text":"In ActivityThread.handleBindApplication, installContentProviders() is called before callApplicationOnCreate(), so every manifest-declared ContentProvider's onCreate executes first. Since this happens on the critical path to the first frame, any provider that touches disk, crypto, or a database in onCreate adds cold-start latency invisible in the app's own Application.onCreate code, appearing only in a system trace of the provider-install phase. daily.dev helps engineers chasing cold-start regressions track ordering quirks like this one."}}]}
```

