• Hey everyone,

    I'm the developer of Catima, an Open Source loyalty card app for Android. People have been asking for WearOS support, but I am kinda not looking forward to supporting only proprietary platforms, so I've been trying to figure out if I can support Bangle.js instead.

    Specifically, I want to support getting a list of your loyalty cards and when clicking a card show the barcode. This would need at least some kind of 2-way communication and I was wondering if it's possible to:

    1. Either send a result to an intent back to Bangle.js (so you could start an intent for GET_CARD_LIST and do something with that data)
    2. Or send data through intents to Bangle.js through Gadgetbridge asynchronously by calling some intent that will make Gadgetbridge forward data to Bangle.js
    3. Do something completely different altogether

    Is this possible? And if data is sent back somehow, is it possible to send an image file back so that the Bangle.js won't need any code to render barcodes itself?

    Thanks in advance for any answer :)

    P.S.: Is there any reason why the forum doesn't have a valid SSL certificate? Could this be fixed by any chance?

    1. Will Bangle JS screen resolution 176x176 enough to show a barcode?
    2. why do you need to send a barcode multiple times? Load that into the watch once and then just show.
  • Will Bangle JS screen resolution 176x176 enough to show a barcode?

    Well, it'll be small, but I'd hope so. I am carefully optimistic seeing how clear the screen is.

    why do you need to send a barcode multiple times? Load that into the watch once and then just show.

    I'm not completely sure what you mean here, could you elaborate?

  • do you really need to send barcodes from Android to Bangle each time a user wants to show a barcode in a store?

  • Here are some links! :)

    Gadgetbridge Bangle.js flavor documentation - intents. Maybe you want to do something with http-requests? There's some info about that here as well.

    Sending intents from android to Bangle.js is possible.

    Sending intents from Bangle.js to android is possible.

  • Do you really need to send barcodes from Android to Bangle each time a user wants to show a barcode in a store?

    Well, it seems like the best user experience as it allows you to keep managing your loyalty cards on your phone instead of having to duplicate the cards you care about.

    Maybe you want to do something with http-requests? There's some info about that here as well.

    That is an option, but intents are the more "native Android" option. With intents I wouldn't have to have a long-running webserver process and Android natively supports shielding intents behind permissions so only apps you've given the relevant custom permission can call the intent (Gadgetbridge would be one of those apps).

    Sending intents from android to Bangle.js is possible.

    Thanks, I had trouble finding anything like this in the documentation. So, com.banglejs.uart.tx it is. I suppose I could send an intent with a "callback intent name", so non-Bangle.js watches could easily relate to their intent.

    This could work, thank you :) Lot of work and I have other tasks to complete first, but I have a route to explore now :)

  • Do you really need to send barcodes from Android to Bangle each time a user wants to show a barcode in a store?

    Well, it seems like the best user experience as it allows you to keep managing your loyalty cards on your phone instead of having to duplicate the cards you care about.

    Sending bitmaps via BLE each time may be not a best way to do it.
    Barcodes are basically 1 row of pixels expanded vertically. I would send 1 row bitmap and then expand it in Bangle JS. 176/8 will be just 12 bytes.

  • Well, the "standard" barcodes are. But Aztec, Data Matrix, PDF 417 and QR codes are not. So this optimization would only be possible for some barcode types.

  • Hmm, all cards I have have "standard" barcodes. :)
    Another way of optimization - to get a checksum(like md5) from a bitmap and put it in local cash. Android will send list of card names with checksums, Bangle app will check checksums in local cash, if not found it will request to download it from Android.

  • Hi! Adding support for Bangle.js in your app sounds great!

    Hopefully com.banglejs.uart.tx should work pretty well for you - in fact you may not actually need to have an app on the Bangle at all - you could just send everything you want to execute (including the menu itself) as JavaScript code to com.banglejs.uart.tx.

    That way it'd 'just work' without needing a specific app installed on the Bangle first.

  • Oh, that's cool!

  • Hmm, well, I guess I can start with a "Send to smartwatch" feature maybe, to keep it simple. But it still feels incorrect for Catima to contain the logic for Bangle.js' UI. Useful for prototyping though!

  • it still feels incorrect for Catima to contain the logic for Bangle.js' UI

    Since the menus are in Bangle.js already, the UI logic is probably just sending E.showMenu({"Barcode 1": ()=>Bluetooth.println(...), "Barcode 2": ()=>Bluetooth.println(...), ... });\n so it's not too bad.

    Up to you what you want to do, but if you have a separate app then you've also probably got to add extra logic in there to check that the Bangle.js app is installed and the version matches your Android app (in case at some point you need to change the protocol).

    Personally, I think it would be nice to be able to use the Bangle to display barcodes without needing the phone connected (while still using the phone to actually manage everything). If that's the case then a Bangle.js app would make far more sense though - and you could use Catima to just sync the barcode data that's on the Bangle...

  • Any news on this? I once had the crazy idea of wanting Opentasks tasks on the bangle without the need of modifying open tasks at all. Didn't dig into it too much for lack of knowledge on the android layer, but my idea was to use the share button which would produce a text, send it to gadgetbridge as a FW/App (the menu is there but I'm not sure it works, it didn't when I tried) and maybe have it ask what name should the file have on the bangle.
    Not a real synchronization but quick and easy for the use case in which you want to put something once on your bangle from any app (a shopping list or a train ticket from catima), which could be displayed and managed by a companion app on the watch itself.
    Do you think this can be useful? How much of this can already work/can be done with low effort?

  • .

  • I haven't made any progress on this myself. However, the Gadgetbridge team passed by and started doing https://codeberg.org/Freeyourgadget/Gadg­etbridge/pulls/2953, which hopefully helps.

  • Good to know, looks promising!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

2-way communication with Android app (through intent?)

Posted by Avatar for TheLastProject @TheLastProject

Actions