Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion firebase-sessions/test-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
android:exported="true"
android:label="@string/app_name"
android:name=".MainActivity"
android:process=":main"
android:theme="@style/Theme.Widget_test_app.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ class TestApplication : MultiDexApplication() {
override fun onCreate() {
super.onCreate()
Log.i(TAG, "TestApplication created on process: $myProcessName")
FirebaseApp.initializeApp(this)

// Initialize firebase for all processes except the default process
// The default process will get initialized automatically by FirebaseInitProvider
if (myProcessName != packageName) {
FirebaseApp.initializeApp(this)
}
Comment on lines +43 to +45
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

To prevent potential double initialization and a crash on startup, also check if myProcessName is not "unknown" before initializing Firebase. This prevents initialization if the process name couldn't be determined, avoiding conflicts with FirebaseInitProvider.

Suggested change
if (myProcessName != packageName) {
FirebaseApp.initializeApp(this)
}
if (myProcessName != "unknown" && myProcessName != packageName) {
FirebaseApp.initializeApp(this)
}


if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
registerReceiver(
Expand Down
Loading