-
Notifications
You must be signed in to change notification settings - Fork 399
/
EmulatorSuite.java
24 lines (18 loc) · 784 Bytes
/
EmulatorSuite.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.google.firebase.referencecode.database;
import com.google.firebase.database.FirebaseDatabase;
public class EmulatorSuite {
public void emulatorSettings() {
// [START rtdb_emulator_connect]
// 10.0.2.2 is the special IP address to connect to the 'localhost' of
// the host computer from an Android emulator.
FirebaseDatabase database = FirebaseDatabase.getInstance();
database.useEmulator("10.0.2.2", 9500);
// [END rtdb_emulator_connect]
}
public void flushRealtimeDatabase(FirebaseDatabase database) {
// [START rtdb_emulator_flush]
// With a DatabaseReference, write null to clear the database.
database.getReference().setValue(null);
// [END rtdb_emulator_flush]
}
}