App interfaces don't work inside Gadgetbridge
Closed this issue · 6 comments
...I have not tested them all, but this is generally my experience.
Example with Schedulers interface:
- Open app loader inside Bangle.js Gadgetbridge.
- Navigate to Scheduler app entry (make sure it's installed on the watch).
- Click the floppy disk icon of Scheduler app entry to try and access its interface.
- The interface starts loading and the UI is visible behind a dialog saying "Please wait Loading...".
- The dialog doesn't go away.
- Clicking the interface's x-button takes me back to the app loader window.
Logcat that starts on step 3 above is attached:
logcat-clicking-scheduler-floppy-disk-icon-in-app-loader-in-gadgetbridge.txt
I don't know what the approach should be. Maybe it's hard to implement e.g. Recorders interface inside Gadgetbridge. One could imagine the downloaded file being stored in Gadgetbridge's Export/Import directory - but I don't know how hard that would be to implement. But the Scheduler one shouldn't be too hard to get working I'd think - but I know hardly anything about webviews so maybe shouldn't say too much.
Just to be clear, this is the interface.html - not custom.html - those pretty much all work fine I think.
I encountered this before with openstmap and didn't have a chance to look into it fully, but as far as I could see it's some issue with how char code 255 (0xff) is received and pushed to JavaScript. Without it the functions in Comms that end up receiving files/data/etc don't know that the transmission has ended.
Thanks for clarifying! (Yes - I was under the impression those were the same thing 🙃)
You can debug by connecting your phone with adb, then going to chrome://inspect/#devices in Chrome once the app loader is loaded in Gadgetbridge.
Paste this into the console:
var oldBangleRx = bangleRx; bangleRx = function(d) { console.log("RX",JSON.stringify(d)); oldBangleRx(d); }
Android.bangleTx("\x10Bluetooth.println('Hello')\n")
Then you get "Hello\r\n" - great.
But:
Android.bangleTx("\x10Bluetooth.println('\\xff')\n")
Gives "�\r\n" and "�\r\n".charCodeAt() == 65533
The code is getting there ok though because:
Android.bangleTx("\x10Bluetooth.println('\\xff'.charCodeAt())\n")
gives "255\r\n" - so it's a Gadgetbridge issue about how char code 255 ends up translated to a JS a string. It's probably UTF8 related again :(
The idea was we use the JSON library to create a JS string, but I wonder what Android thinks is in that String - whether it's char code 255 or 65533
I've had trouble using adb directly. But I can use wireless debugging with Android Studio to build and install to my phone. I'll try and read up on it again.
I just added some code that should help with downloads too - although for it to work for must stuff I'll need to update the app loader (turns out we can't download Blob, so we have to download with base64 links instead)