shamanec / GADS-devices-provider

Set up iOS/Android devices for remote control with GADS UI and Appium test execution
MIT License
31 stars 4 forks source link

GADS Device Provider Error #52

Closed ernsd90 closed 1 month ago

ernsd90 commented 1 month ago

Provider works [GIN-debug] Listening and serving HTTP on :10001

but on UI panel, it show nothing, As you can see, the screenshot provider is active

Screenshot 2024-05-07 at 1 38 10 AM
shamanec commented 1 month ago

If you are by any chance using it on Chrome - it doesn't work because Chrome does not allow non-secure websocket connections - you can check in the Network tab of the chrome dev options to see if that is the reason 😞

ernsd90 commented 1 month ago

Yes, I am using Chrome and the Brave browser. On both not getting device, Also I'm using same server for both UI and Device provider

Screenshot 2024-05-07 at 1 50 42 PM
shamanec commented 1 month ago

Ah, the connection seems to be working since you got messages, but you just don't have devices 😅 I don't know, the provider doesn't seem to be providing anything - have you checked logs/provider.log file for info? Maybe these days I'll add some rudimentary provider log table directly in the UI

ernsd90 commented 1 month ago

here are some of the latest logs, I have installed APK from conf folder.

{"event":"provider","level":"info","msg":"Attempting to remove all adb forwarded ports on provider start","time":"2024-05-07T00:12:16-04:00"} {"event":"provider","level":"info","msg":"Downloading latest GADS-stream release apk file","time":"2024-05-07T00:12:16-04:00"} {"event":"provider","level":"info","msg":"Latest GADS-stream release apk was successfully downloaded","time":"2024-05-07T00:12:22-04:00"} {"event":"provider_setup","level":"info","msg":"Starting provider on port 10001","time":"2024-05-07T04:07:00-04:00"} {"event":"provider_setup","level":"info","msg":"Starting provider on port 10001","time":"2024-05-07T04:07:53-04:00"} {"event":"provider_setup","level":"info","msg":"Starting provider on port 10001","time":"2024-05-07T04:09:49-04:00"} {"event":"provider","level":"info","msg":"Checking if adb is available on host","time":"2024-05-07T04:09:54-04:00"} {"event":"provider","level":"info","msg":"Attempting to remove all adb forwarded ports on provider start","time":"2024-05-07T04:09:54-04:00"} {"event":"provider","level":"info","msg":"GADS-stream apk is available in the provider conf folder, it will not be downloaded. If you want to get the latest release, delete the file from conf folder and re-run the provider","time":"2024-05-07T04:09:54-04:00"}

I have setup both "[GADS]" and "[GADS-devices-provider]" on a Linux Server. How does the APK link with this server?

shamanec commented 1 month ago

Have you enabled USB Debugging for the Android device from Developer tools? I dont see any errors but also it doesnt seem to be detecting any connected devices as well :) Also the APK does not directly correlate with the server - the APK is the video stream app I created for Android so that the device screen can be seen in the browser - this is just informative log message

ernsd90 commented 1 month ago

Yes, I did. one quick question
I have setup both "[GADS]" and "[GADS-devices-provider]" on a Linux Server. How does the APK link with the server?

shamanec commented 1 month ago

The APK runs the stream app on the device on a specific port, then adb forwards this port to a randomly assigned by the provider port on the host itself. After that the stream is handled and exposed on an endpoint of the provider server like /device/{someudid}/android-stream for example :) Judging by the logs though no devices are detected by adb(which the provider uses under the hood) - have you accepted the security popup on the device after enabling USB debugging? If you open Terminal and execute adb devices do you see your device in the list?

ernsd90 commented 1 month ago

Below is an outline of the steps we have taken and the current problem:

Server Setup: We are utilizing a Linux server with the IP address 92.222.123.23.

GADS (UI) Installation: The GADS UI has been successfully installed and is accessible via http://92.222.123.23:10000/.

GADS-Devices-Provider Installation: We have also installed the GADS-devices-provider on the same server (92.222.123.23).

Provider Configuration: A new provider was configured on the GADS UI under the "Providers administration" tab at http://92.222.123.23:10000/admin. And its PORT is 10001

Provider Execution: We executed the provider with the following command: ./GADS-devices-provider --nickname=jimmy --mongo-db=92.222.123.23:27017 --provider-folder="/var/data/www/Gads-provider/provider-data" --log-level="debug" Following this command, the provider status appeared as "Online" under the nickname "jimmy" in the "Providers administration" tab.

APK Installation: The GADS streaming application (APK) was installed on a physical device from the path /var/data/www/Gads-provider/provider-data/conf/gads-stream.apk. and its connened with mobile network

Casting Permission: Post-installation, the necessary permissions for casting were granted on the device. Issue Encountered: Despite the above setups, the device does not appear in the "Providers administration" tab under the nickname "jimmy" nor in the "device" tab.

Given these details, I am at a loss as to why the device is not being recognized by the system. It seems all configurations and setups were implemented correctly, yet the device remains undetected. Could you please advise on potential reasons for this issue or provide steps for further troubleshooting?

shamanec commented 1 month ago

The provider uses adb under the hood to detect connected devices so if USB debugging is enabled and the device is connected to the provider host - then the provider should pick it up and at least try to provision it, even if it fails to do so. That is why I asked you to test executing adb devices to see if your device appears in the adb list. Also UI and provider should not be running on the same port, I don't even know how you manage to start them at the same time on the same port if its already bound by the first started service 🤔

ernsd90 commented 1 month ago

Ohh I think its a typo error we are using different PORTS for both Ui Port 10000 Provider 10001

And yes I checked with "adb devices" there is an emulator in the list. Also please let me know should we need to add Web Socket link to APK code?

shamanec commented 1 month ago

oh :D yeah, provider does not support emulators currently, only real devices :D maybe I should explicitly state this somewhere or just spent some time when I have it to support emulators as well :) On the apk note - the APK is only for a "video stream", it doesn't do anything else. The provider in turn processes the "video stream" and exposes it on an endpoint - there is nothing you should need/have to do on that part

ernsd90 commented 1 month ago

Thank you for the support. I have another question: If the APK is designed solely for "video streaming," how does it connect with the provider?

Or its only work on local network??

shamanec commented 1 month ago

Already explained it here :P In general the project is meant for local network but in theory you can expose the UI with a few changes using nginx or something similar in conjunction with ngrok or whatever you prefer over a non-local network :)