Skip to content

Commit 0c2950b

Browse files
authored
Merge pull request #54 from jpage4500/feature/12-13
Refactor device pairing logic; send custom commands via remote control
2 parents 330787a + 7c95173 commit 0c2950b

23 files changed

Lines changed: 488 additions & 196 deletions

CLIENT_SERVER.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Running a server and connect to it from a client
2+
3+
Android Device Manager can manage devices connected to another computer running device manager.
4+
Both computers need to be running the latest version of Device Manager.
5+
See [this](https://github.com/jpage4500/AndroidDeviceManager?tab=readme-ov-file#install-android-device-manager) page for installation instructions.
6+
7+
# Network Setup
8+
9+
If both computers are on different networks, you’ll need some way to make both computers talk to each other across the Internet.
10+
11+
I’ve tested with free [ngrok](https://ngrok.com/) and [TailScale](https://tailscale.com/) services
12+
13+
# Tailscale
14+
- Install [Tailscale](https://tailscale.com/) on both computers and login with the same account.
15+
16+
# Server Setup
17+
- The server can be started from within the app. Click on the SERVER toolbar button and select "Start Server".
18+
19+
![img.png](resources/server_stopped.png)
20+
21+
- Click on Start Server button to start the server
22+
- Click Copy Connection String button
23+
- If you have a Tailscale network running, select the IP address or hostname of the Tailscale network. This is how the client will reach the server.
24+
25+
![img_1.png](resources/server_select_ip.png)
26+
27+
# Client Setup
28+
- Connect to a server using the Connect toolbar button -> "Connect to Server"
29+
30+
![Connect to Server](resources/server_connect.png)
31+
32+
- You can manually connect to a server using the IP/port/auth token. Or, if you were able to use the "Copy Connection
33+
String" button above, hit "Paste Connection" and the details will be filled in automatically.
34+
35+
![img_2.png](resources/client_add.png)

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Android Device Manager is a desktop app which can manage one or more Android dev
77
## Features ##
88

99
- View all connected (and wireless) devices
10+
- View devices connected to another computer (see [SERVER.md](SERVER.md))
1011
- Populates device **phone number, free space, IMEI, carrier** (if available)
1112
- **Remote control** selected devices (requires [scrcpy](https://github.com/Genymobile/scrcpy))
1213
- Capture **screenshots** of selected devices
@@ -17,12 +18,15 @@ Android Device Manager is a desktop app which can manage one or more Android dev
1718
- delete folders/files
1819
- root mode supported
1920
- View **Device Logs**
20-
- NOTE: this is a work in progress!
21+
- filter by log level/tag
22+
- add and combine filters to make searching logs easier
2123
- **Restart** selected devices
2224
- Run **user-defined adb commands**
25+
- Run **user-defined scripts**
2326
- Set and display custom properties on each device
2427
- Start an **adb shell** session with selected devices
2528
- **View version** of user-defined list of apps
29+
- Connect to devices wirelessly via **QR code**
2630

2731
## Manage devices connected to other computers ##
2832

SERVER.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ java -jar $ADM --server --port 5555 --auth-token "HELLO WORLD"
4545

4646
## Connecting to the Server
4747

48-
Connect to a server using the Connect toolbar button -> "Connect to Server"
49-
![Connect to Server](resources/server_connect.png)
50-
51-
You can manually connect to a server using the IP/port/auth token. Or, if you were able to use the "Copy Connection
52-
String" button above, hit "Paste Connection".
48+
See the [this page](CLIENT_SERVER.md) for more details on running a server and connecting to it from a client.
5349

5450
## Viewing Remote Devices
5551

@@ -64,3 +60,5 @@ Most actions such as screenshot, install, remote command, etc can be run on remo
6460
Instead of running scrcpy which is used locally, remote mirroring a device sends a series of compressed screenshots from the server to the client.
6561

6662
You can interact with the device by clicking on the screen to send a click. Long-presses and swipes are also supported. Typing on the keyboard will send key events to the remote device as well.
63+
64+
![Mirror Client](resources/client_mirror.png)

resources/client_add.png

32.1 KB
Loading

resources/client_mirror.png

399 KB
Loading

resources/file.pxm

-2.81 KB
Binary file not shown.

resources/server_select_ip.png

30.5 KB
Loading

resources/server_stopped.png

54.4 KB
Loading

src/main/java/com/jpage4500/devicemanager/MainApplication.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
package com.jpage4500.devicemanager;
22

33
import com.formdev.flatlaf.FlatLightLaf;
4-
import com.jpage4500.devicemanager.data.Icons;
54
import com.jpage4500.devicemanager.logging.AppLoggerFactory;
65
import com.jpage4500.devicemanager.logging.Log;
76
import com.jpage4500.devicemanager.manager.DeviceManager;
87
import com.jpage4500.devicemanager.manager.server.RemoteServerManager;
98
import com.jpage4500.devicemanager.ui.DeviceScreen;
10-
import com.jpage4500.devicemanager.utils.*;
9+
import com.jpage4500.devicemanager.utils.PreferenceUtils;
10+
import com.jpage4500.devicemanager.utils.RemoteConnectionUtils;
11+
import com.jpage4500.devicemanager.utils.TextUtils;
12+
import com.jpage4500.devicemanager.utils.Utils;
1113
import org.slf4j.ILoggerFactory;
1214
import org.slf4j.Logger;
1315
import org.slf4j.LoggerFactory;
1416

1517
import javax.swing.*;
1618
import java.awt.*;
17-
import java.awt.image.BufferedImage;
1819
import java.io.File;
1920
import java.io.IOException;
2021
import java.util.ArrayList;
@@ -150,18 +151,6 @@ private void initializeUI(String[] args) {
150151
defaults.put("defaultFont", new Font("Arial", Font.PLAIN, 16));
151152
defaults.put("Button.defaultButtonFollowsFocus", Boolean.TRUE);
152153

153-
if (Taskbar.isTaskbarSupported()) {
154-
try {
155-
Taskbar taskbar = Taskbar.getTaskbar();
156-
if (taskbar.isSupported(Taskbar.Feature.ICON_IMAGE)) {
157-
BufferedImage image = UiUtils.getImage(Icons.LOGO, 256);
158-
taskbar.setIconImage(image);
159-
}
160-
} catch (final Exception e) {
161-
log.error("initializeUI: Taskbar Exception: {}", e.getMessage());
162-
}
163-
}
164-
165154
deviceScreen = new DeviceScreen();
166155

167156
// handle command line args

src/main/java/com/jpage4500/devicemanager/data/Icons.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public enum Icons {
3333
EYE_CLOSED("eye_closed.png"),
3434
EYE_OPEN("eye_open.png"),
3535
FILE("file.png"),
36+
FILE_ADB("file_adb.png"),
3637
FILE_APK("file_apk.png"),
3738
FILE_JSON("file_json.png"),
3839
FILE_LINK("file_link.png"),

0 commit comments

Comments
 (0)