Connect Your Device
The Snapbug SDK communicates with the Desktop app over two channels:
- WebSocket on port 9023 -- real-time bidirectional data (plugin messages, live updates)
- HTTP on port 9024 -- file uploads (screenshots, database files, etc.)
There are three ways to establish this connection.
USB Connection (recommended)
USB is the most reliable method. It uses ADB port forwarding to tunnel traffic from your device to your computer over the USB cable.
1. Connect your device via USB
Plug in your Android device with USB debugging enabled. Verify it is detected:
adb devices2. Set up port forwarding
Forward both ports:
adb forward tcp:9023 tcp:9023
adb forward tcp:9024 tcp:90243. Launch the app
Start the Snapbug Desktop app on your computer, then run your Android app with the SDK initialized. The Desktop app will detect the connection automatically.
Port forwarding must be re-established each time you reconnect the USB cable or restart ADB. You can add these commands to a shell alias or script for convenience.
Wi-Fi Connection
Connect wirelessly when your device and computer are on the same local network.
1. Find your computer's IP address
ipconfig getifaddr en02. Configure the SDK to use the IP address
Set the server host in your app before initializing:
Snapbug.updateServerHost("192.168.1.42") // your computer's local IP
Snapbug.initialize(this)3. Launch both apps
Start the Desktop app, then run your Android app. They will connect over your local network.
Some corporate, hotel, or public Wi-Fi networks isolate devices from each other. If the connection fails, try USB instead or switch to a home network.
Emulator
Android emulators running on the same machine as the Desktop app share localhost. No port forwarding or IP configuration is needed -- the SDK connects automatically.
Just launch the Desktop app and run your app on the emulator.
If the emulator does not connect, verify that no other process is using ports 9023 or 9024. You can check with lsof -i :9023 on macOS/Linux.
Connection Indicator
The Snapbug Desktop app shows a connection indicator in the top-left corner:
- Green -- a device is connected and communicating
- Gray -- no device connected, waiting for a connection
When a device connects, the indicator turns green and the device name and app package appear in the sidebar.
Multiple Devices
Snapbug Desktop supports one device connection at a time. If you need to switch devices, disconnect the current one (close the app or unplug) and connect the new device.
Troubleshooting
If the connection is not working, see the Troubleshooting page for common fixes including network security configuration and ADB issues.