Note
Wireless Debugging requires you to be connected to a wifi network to work, else Wireless Debugging Settings might not open
so there are basically two steps pairing and connecting.
we use ngrok for accessing ports publically
- Go to
Developer Options>Wireless Debuggingafter connecting to a wifi device - Enable it, and click on
Pair device with pairing code - note the
<PORT>and<PAIRING_CODE> - now in termux expose that port using ngrok, note the url (tcp://
<NGROK_URL>)ngrok tcp <PORT>
- Now in IDX Terminal run
adb pair <NGROK_URL> <PAIRING_CODE> - The device is paired
Tip
Disable adb authorization timeout in developer options, so that you don't need to re-pair it after 7 days
After the device is paired, its trusted by the phone, and can connect it without pairing again
Whenever connecting,
- Open
Wireless Debugging, and note the<PORT>inIP address & Port - again expose that in ngrok and note the
<NGROK_URL>ngrok tcp <PORT>
- In IDX Terminal connect to phone
adb connect <NGROK_URL>
- Devices is connected
- Run on device using flutter
flutter run -d <NGROK_URL>
Warning
This method is less secure (Anyone with the ngrok url can adb into your device without any extra step)
- Enable
USB Debugging, connect your device to PC - start the
adbddaemon on any port, say5555adb tcpip 5555
- In your termux, expose that port using ngrok, note the
<NGROK_URL>ngrok tcp 5555
- connect to device in IDX
adb connect <NGROK_URL>
- Run app on device
flutter -d <NGROK_URL>
thanks thats great