- Posts: 69
- Thank you received: 2
Android 11 support (my attempts)
- RoyN
- Topic Author
- Offline
- User
-
Hi,
A while back I realized that my TV box was not going to work with myServer (in its currrent state) because it was running Android 11, and the ADB authentication scheme has changed...
I was working on trying to get it up and running now, and I've run into a myServer question/issue... I'll document my steps on this thread so others can hopefully get it working once it works for me.
What I've done so far
on the Android Box:
- Enable WIFI Debugging (as opposed to just ADB) on the Android
- Allow ADB debugging on the connected network (tick remember this network)
- Select "Pair with code" and make note of the IP, Port & 6 digit pin. Close the dialog box.
- Make note of the IP/Port that ADB is using (this may be different from the Port you noted above. It will be the same IP, however). (We'll call this PORTADB)
On myServer
- Access terminal (ssh or web terminal or equivalent)
- Download the updated ADB tools for Arm (raspberry pi) from: github.com/lzhiyong/android-sdk-tools/releases
- unzip and replace the folder /home/allonis/applications/platform-tools with the folder from the archive (I renamed my old platform-tools to keep as a backup)
- run "adb kill-server"
- run "adb pair IP:PORT" (then enter the pin code when requested - the Pin, IP and Port are the ones you got on the Android Box above).
- run "adb connect IP:PORTADB
- run "adb devices" to confirm the box is correctly connected.
- go into the AndroidTV Driver, Driver Test, then AddDevice, and customize the command to add the correct IP, Port, etc for the device
At this point i'm pretty much stuck... Even after adding the device as above I dont seem to be able to make it work. I get some errors such as:
1
1/04/2024 20:45:47.45 · DEBUG · AndroidTV.doCommand - Cmd=[7~SendKey~Back] Client=[dashboard-fx-x1vs]
11/04/2024 20:45:47.45 · ERROR · AndroidTV.doCommand - Error in doCommand - Object reference not set to an instance of an object.
11/04/2024 20:45:49.45 · DEBUG · Server.doCommand - AV|{{active_androidtv_{{clientname}}}}~SendKey~Back from dashboard-fx-x1vs
11/04/2024 20:45:49.45 · DEBUG · Server.doCommand - AV|7~SendKey~Back
11/04/2024 20:45:49.45 · DEBUG · AndroidTV.doCommand - Cmd=[7~SendKey~Back] Client=[dashboard-fx-x1vs]
11/04/2024 20:45:49.45 · ERROR · AndroidTV.doCommand - Error in doCommand - Object reference not set to an instance of an object
Apart from this there are several issues which seem to be widespread about Android 11... Namely the Wifi adb doesnt persist after a reboot (or randomly in my experience). Also, every time the unit is rebooted, reconnects to wifi, or has its Wifi ADB put back on, the ADB port updates to another random number...
So this is where I'm stuck... I wonder if others have attacked this issue differently?
One thing that comes to mind is using a IRUsb device from Video-Storm... its pretty cheap and I remember I used it to integrate a Shield with a Control4 project once... I just checked and it seems to allow IP control without the ADB hassles... www.video-storm.com/manuals/IrUSB_protocol.pdf is the protocol info... Would this be possible to be supported in myServer to connect to Android devices that are Android 11+?
EDIT: It's slightly more expensive than I remember (around $75) but is an option I'd consider if supported in myServer.
EDIT2: possible solution to get the changing port here: stackoverflow.com/a/72987868 Android 11 still seems like a pain in the A##
Please Log in to join the conversation.
- bowlingbeeg
- Offline
- User
-
- Posts: 248
- Thank you received: 33
Please Log in to join the conversation.
- davep
- Offline
- Admin
-
- Posts: 367
- Thank you received: 96
First, from the myServer controller make sure that the version of ADB that is installed supports the ADB Pair command. If ADB Pair returns "unknown command pair" then you'll need a newer ADB.
For anyone wanting to do this on an Allonis PI the steps are:
Download this arm64 version from github.com/lzhiyong/android-sdk-tools/re...s-static-aarch64.zip .
Unzip this to the /usr/lib/android-sdk/platform-tools folder replacing the files that are there. You'll need sudo for this.
wget github.com/lzhiyong/android-sdk-tools/re...s-static-aarch64.zip
unzip android-sdk-tools-static-aarch64.zip
sudo cp platform-tools/* /usr/lib/android-sdk/platform-tools
Then ADB pair should work.
On the Android device make sure you enable Wireless debugging and click on ."Pair device with pairing code"
Note the IP Address & Port shown in the Pair with device dialog.
From the myServer controller's terminal window issue the command
adb pair ip Address and port from above.
for example: adb pair 192.168.0.124:45361
When prompted to "Enter pairing code" type in the pairing code as displayed on the Android device.
You should get a "Successfully paired to" message displaying a pairing guid like [guid=adb-R5CRC3LT5RK-jtXDDE]
Now from the Android driver in the Dashboard you will need to manually add a new AndroidTV device.
Select AddDevice from the command builder:
Make sure to select IP Port 0, and set the MAC Address field to the value of the quid from above. Your command should look something like.
AndroidTV|AddDevice~New ATV~192.168.0.124~0~AndroidTV~0~~adb-R5CRC3LT5RK-jtXDDE~Unknown
Execute the command to add the device.
When the AndroidTV device is using port 0 that will trigger additional logic in the driver to automatically go out and find the current adb port on the device and use that.
Once it finds the port it will connect to it.
Now, my experience with my Samsung phone is that each time the phone is restarted it will not automatically enabled wireless adb debugging. You'll have to remember to go back in and re-enable when your Android device restarts. Also, another added feature is that it will assign a new adb port every time it gets enabled. The driver has logic in it to catch the old port becoming invalid and going out and finding the new one.
This has been working fine here using my Samsung Galaxy phone as the test device.
Once it is connected then all the normal adb commands will work.
Lots of steps but the bulk of them only need to happen once.
Let us know how this works for you.
Please Log in to join the conversation.
- RoyN
- Topic Author
- Offline
- User
-
- Posts: 69
- Thank you received: 2
As for myself, I dont want to be re-enabling ADB often, and my tv box shuts down randomly... so I'll probably try using another tv box such as a Mi Box I have... Thanks anyways for working on this! I'm sure it will be useful for others.
As for the IrUSB yes, it is really fast, and faster than other experiences I had with ADB. Could be something to look into supporting at a later date.
Please Log in to join the conversation.
- RoyN
- Topic Author
- Offline
- User
-
- Posts: 69
- Thank you received: 2
I think another user was successful in "creating his own integration" through TCP... From the irusb manual it shouldnt be too difficult, there isnt any authentication as far as I saw, just a question of sending a text string through a tcp port... I'll try and find the post here mentioning that and if I get the courage to try it out I'll order an irusb as I have no idea where my old ones have ended up... (they will surface once I have buoght others lol)
Please Log in to join the conversation.
- bowlingbeeg
- Offline
- User
-
- Posts: 248
- Thank you received: 33
Please Log in to join the conversation.