Skip to content

Anyway to detect specific device disconnect? #548

Answered by yume-chan
kainbryanjones asked this question in Q&A
Discussion options

You must be logged in to vote

In a previous version Adb class uses AdbBackend instances directly to communicate with devices, so it was possible to read the serial number via adb.backend.serial. But now Adb and AdbBackend are decoupled, Adb only requires a ReadableWriablePair and AdbBackend has a connect method to provide that, it's not possible to read the serial number from Adb instance.

You need to keep the backend instance or at least the serial number somewhere else in your code, like the demo project does:

export class GlobalState {
backend: AdbBackend | undefined = undefined;
device: Adb | undefined = undefined;

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kainbryanjones
Comment options

Answer selected by kainbryanjones
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants