firebase emulator with real devices

673

Finally, I am able to run firebase emulator with real devices. Thats how firebase.json looks like. I added the "host":"192.168.1.114". 192.168.1.114 is the IP assigned to your computer by router.

{
  "emulators": {
    "auth": {
      "host":"192.168.1.114",
      "port": 9099
    },
    "functions": {
      "host":"192.168.1.114",
      "port": 5001
    },
    "firestore": {
      "host":"192.168.1.114",
      "port": 8080
    },
    "ui": {
      "enabled": true
    }
  }
}

After changing the firebase.json. I added the following lines for auth and firestore respectively.

auth().useEmulator("http://192.168.1.114:9099");
firestore().settings({ host: "192.168.1.114:8080", ssl: false });

After these changes, I was able to push data to the firebase emulator from real devices. Your computer and devices should be connected with the same network.

Share:
673
user1927603
Author by

user1927603

Updated on December 29, 2022

Comments

  • user1927603
    user1927603 over 1 year

    I am building a react-native app. And I want to test my code on real devices. Has anybody tried the firebase emulator with real iphone/android devices? In my case,Firebase emulator worked fine with the Android emulator/Iphone simulator but not with real devices. I am getting the following error.

    Error [Error: [auth/network-request-failed] A network error (such as timeout, interrupted connection or unreachable host) has occurred.]

    Thanks in advance!!