File tree 3 files changed +25
-2
lines changed
database/app/src/main/java/com/google/firebase/referencecode/database
firestore/app/src/main/java/com/google/example/firestore/kotlin 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ public void emulatorSettings() {
13
13
// [END rtdb_emulator_connect]
14
14
}
15
15
16
- public void flushRealtimeDatabase (FirebaseDatabase ) {
16
+ public void flushRealtimeDatabase (FirebaseDatabase database ) {
17
17
// [START rtdb_emulator_flush]
18
18
// With a DatabaseReference, write null to clear the database.
19
- FirebaseDatabase . getInstance () .getReference ().setValue (null );
19
+ database .getReference ().setValue (null );
20
20
// [END rtdb_emulator_flush]
21
21
22
22
}
Original file line number Diff line number Diff line change
1
+ package com.google.firebase.referencecode.database.kotlin
2
+
3
+ import com.google.firebase.database.FirebaseDatabase
4
+
5
+ class EmulatorSuite {
6
+
7
+ fun emulatorSettings () {
8
+ // [START rtdb_emulator_connect]
9
+ // 10.0.2.2 is the special IP address to connect to the 'localhost' of
10
+ // the host computer from an Android emulator.
11
+ // In almost all cases the ns (namespace) is your project ID.
12
+ val database = FirebaseDatabase .getInstance(" http://10.0.2.2:9000?ns=YOUR_DATABASE_NAMESPACE" )
13
+ // [END rtdb_emulator_connect]
14
+ }
15
+
16
+ fun flushRealtimeDatabase (database : FirebaseDatabase ) {
17
+ // [START rtdb_emulator_flush]
18
+ // With a DatabaseReference, write null to clear the database.
19
+ database.reference.setValue(null )
20
+ // [END rtdb_emulator_flush]
21
+ }
22
+ }
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ class EmulatorSuite {
12
12
val settings = FirebaseFirestoreSettings .Builder ()
13
13
.setHost(" 10.0.2.2:8080" )
14
14
.setSslEnabled(false )
15
+ .setPersistenceEnabled(false )
15
16
.build()
16
17
17
18
val firestore = FirebaseFirestore .getInstance()
You can’t perform that action at this time.
0 commit comments