Skip to content

Commit 7005c97

Browse files
Allow initial call to .getReference() from any thread (#22)
1 parent c87bbb2 commit 7005c97

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

firebase-database/src/androidTest/java/com/google/firebase/database/TestHelpers.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import static org.junit.Assert.assertTrue;
2020
import static org.junit.Assert.fail;
2121

22-
import android.os.Looper;
2322
import android.support.test.InstrumentationRegistry;
2423
import com.fasterxml.jackson.core.type.TypeReference;
2524
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -489,7 +488,6 @@ public static void assertContains(String str, String substr) {
489488

490489
public static void ensureAppInitialized() {
491490
if (!appInitialized) {
492-
Looper.prepare();
493491
appInitialized = true;
494492
android.content.Context context = InstrumentationRegistry.getTargetContext();
495493
FirebaseApp.initializeApp(
@@ -504,7 +502,6 @@ public static void ensureAppInitialized() {
504502

505503
public static void ensureConstantsInitialized() {
506504
if (!appInitialized) {
507-
Looper.prepare();
508505
appInitialized = true;
509506
android.content.Context context = InstrumentationRegistry.getTargetContext();
510507
FirebaseApp.initializeApp(

firebase-database/src/main/java/com/google/firebase/database/android/AndroidEventTarget.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
package com.google.firebase.database.android;
1616

1717
import android.os.Handler;
18+
import android.os.Looper;
1819
import com.google.firebase.database.core.EventTarget;
1920

2021
public class AndroidEventTarget implements EventTarget {
2122
private final Handler handler;
2223

2324
public AndroidEventTarget() {
24-
this.handler = new Handler();
25+
this.handler = new Handler(Looper.getMainLooper());
2526
}
2627

2728
@Override

0 commit comments

Comments
 (0)