To view the application status I use this command:
adb shell dumpsys package %pkgname% | findstr /i /c:"User 0: ceDataInode"
But, unfortunately, the stopped parameter does not display the real state of the application. Perhaps there are other similar things in dumpsys, but I have not looked for them yet.
p.s. Found one clever and quick way to determine whether an application is running or not:
adb shell pidof <package_name>
If a PID is returned, the application is running. If an empty string, it is stopped.
I can probably help with the search for IP and port. For this, I use an exe file that scans devices using the mDNS protocol and displays the IP and port of the found device. This application was written at my request specifically for the Kvass program, but I do not have the source code. It is called AndroidMdnsDiscover.
But there is another option, in Python, it does about the same thing, but less convenient - there you need to pre-specify the range of ports for scanning.
These files can be taken from my cloud resource in the ADB-WiFi directory:
In general, everything is done almost automatically through mDNS and through the service _adb-tls-connect._tcp.
There are some good ideas here:
https://stackoverflow.com/questions/65991502/adb-over-wi-fi-android-11-on-window...
Unfortunately, the image quality settings using ADB are very poor, and given the expanded displays on the Meta Quest 3 headset, the useful image is cut off very much. But yes, I have not yet seen any API or documentation in the open. The ideal option would be to implement something similar to what is done in the broadcast via the Meta Quest Developer Hub.
Have you used this program? What they do with the image there is wonderful. But this is done through the API, as far as I understand, and there is no information about it...