Ah yes I should have thought of that before, sorry! So "10.0.2.2" is a special IP address you can use in emulators which says 'let me access the localhost of the host computer'.
When running on a real device you need to do a few things:
1 - Make sure the devices are on the same WiFi network
They'll need to be able to talk to each other over the local network
2 - Determine the local IP address of the computer running the emulators
Follow steps
like these to get your local IP address
3 - Change the firebase.json file to use the new host when you start the emulators
So let's say your local IP is 192.168.1.7 you can do this in your firebase.json
{
"emulators": {
"functions": {
"host": "192.168.1.7",
"port": 5001
}
}
4 - Update your Android code
Finally wherever you're calling useEmulator() make sure to pass "192.168.1.7" (or whatever your real IP is) where you previously passed "10.0.2.2"
- Sam