Situation
I have a bunch of 2FA apps that multiple people need to access. Currently we have one physical device that is stored at the office and it must be physically accessed.
I would like to setup an emulator that can be accessed remotely and setup the 2FA apps there. Accessing it via the usual remote desktop tools is not an option, since shared users are prohibited to us and we only want a single emulator instance.
I already checked the ADB documentation and saw, that it's possible to connect to a device through wifi. However, this requires to input a pairing-code which would require access to the emulator before connecting:
It also states that on Android 10 and lower, there is a workarround to it:
But i would prefer a solution that doesn't rely on old OS versions. Perhaps some way to simulate a USB connection or disable the pairing-security so no code is required.
Question
Is there a way to expose the running emulator in the local network, so it can be connected through adb remotely and then screen mirrored by Android Studio?
Situation
I have a bunch of 2FA apps that multiple people need to access. Currently we have one physical device that is stored at the office and it must be physically accessed.
I would like to setup an emulator that can be accessed remotely and setup the 2FA apps there. Accessing it via the usual remote desktop tools is not an option, since shared users are prohibited to us and we only want a single emulator instance.
I already checked the ADB documentation and saw, that it's possible to connect to a device through wifi. However, this requires to input a pairing-code which would require access to the emulator before connecting: https://developer.android/tools/adb#wireless-android11-command-line
It also states that on Android 10 and lower, there is a workarround to it: https://developer.android/tools/adb#wireless
But i would prefer a solution that doesn't rely on old OS versions. Perhaps some way to simulate a USB connection or disable the pairing-security so no code is required.
Question
Is there a way to expose the running emulator in the local network, so it can be connected through adb remotely and then screen mirrored by Android Studio?
1 Answer
Reset to default 1adb is an insecure protocol, therefore exposing it on a network is not a good idea.
I would set-up on the emulator-host an ssh server and use port forwarding for an adb connection:
Use ssh port forwarding from tcp localhost:5037 to localhost:5037. That will connect your local tcp port 5037 to the remote port TCP port 5037 which allows adb to work through the ssh tunnel.
Make sure no adb server is running on the client system by executing adb kill-server
before starting the ssh connection.
That way the adb client on the client computer connects through ssh to the adb server on the emulator host.
And finally use scrcpy to remote control the emulator.