Bangle companion app

Posted on
  • Note: the original conversation started here from an off-topic question. I opened this new thread because I think this is an interesting topic :-)

    @Gordon says:

    Yes, so basically Gadgetbridge has a big core value of not needing the internet for anything. They will not ever allow any part of Gadgetbridge to directly access the internet - one of the reasons why even getting Weather on it is a pain. They also don't like the Play store, which sucks for most people that just want to get it from a 'safe', easy place.
    So for the KickStarter I said I'd do a new app, but then I got talking to Andreas who is the creator and one of the main maintainers of Gadgetbridge, and we came up with something which I think works well for everyone.
    We agreed that I'd do a new build of Gadgetbridge for Bangle.js, but will try and merge most of my changed upstream so we're working from the same codebase. I'll probably leave all the support for other devices in there anyway, but it'll be on the Play Store, and it'll have internet connectivity and will also be able to host the app loader so you don't have to do a Gadgetbridge disconnect thing to upload apps.

    This sounds great!

    Will the user be able to modify Bangle's settings from Banglebridge? It would be a handy feature! Many smartwatches can be managed through their companion app, eg. the Mi Fit app. When the user want to change something it's usually easier to use the app (e.g. set a recurring alarm, configure the brightness, change a wake on... settings.) In my opinion this would be a great feature :-)


    @Alessandro actually if you're able to help, I'm currently having a hard time just with gradle. I created a new productFlavor for Bangle.js (https://codeberg.org/gfwilliams/Gadgetbr­idge/commit/2a53219a14accdf5c78e02cc3af5­7f3940baf008) and it builds fine and includes a different icon, but I'm damned if I can get app_name or anything else in the main app to be overwritten by the info in strings.xml. As far as I can tell I'm doing everything that's suggested online but it's just not working for some reason.

    I need to install/configure the dev environment but in the next few days I'll try to take a look!

  • Will the user be able to modify Bangle's settings from Banglebridge?

    They'll be able to use the App Loader and the various 'customiser'/'interface' tools in there initially.

    Someone asked this before, and right now anyone can write a 'Settings' tool for the App Loader that allowed you to set settings on the phone. But I think at the moment it's just going to mean a bunch more duplicate code to maintain and keep in sync, and I'm not really sure it's that useful... When the menu system gets easier to use I think less people will see the need for it.

    ... having said that you could theoretically replace E.showMenu on the watch with one that forward menu entries to the phone, and then run the original Settings app - so basically the whole set of Bangle.js options would appear on the phone screen. At least then there's not duplicate code. While PRs are always welcome, it's not high up my personal priority list I'm afraid

  • I forked and downloaded your branch.

    but I'm damned if I can get app_name or anything else in the main app to be overwritten by the info in strings.xml. As far as I can tell I'm doing everything that's suggested online but it's just not working for some reason.

    Sorry but I don't understand your problem. If I edit some strings in app/src/banglejs/res/values/strings.xml and run I see the new values in the virtual device.

    Am I missing something?

  • They'll be able to use the App Loader and the various 'customiser'/'interface' tools in there initially.

    Excellent :-)

    When the menu system gets easier to use I think less people will see the need for it.

    The new menu system is great but there are things I wish I could also do via app (add recurring alarms, timers, change Wake on X, etc. on the fly) but I understand it's not a priority, no problem.

    having said that you could theoretically replace E.showMenu on the watch with one that forward menu entries to the phone, and then run the original Settings app - so basically the whole set of Bangle.js options would appear on the phone screen. At least then there's not duplicate code.

    This is interesting. I could work on it when I get more familiar with code :-)

  • Ok, that's interesting, thanks for checking! I see Gadgetbridge when I run it! Must be my tools then - I'll make sure it's all up to date.

    In terms of alarms there is actually an alarm sync thing in Gadgetbridge already so it's a relatively easy job to implement the handling of that event on the Bangle. I believe someone is already working on it for Q Alarm, but obviously it'd be better if it was done for the default alarm app

  • Ok, that's interesting, thanks for checking! I see Gadgetbridge when I run it! Must be my tools then - I'll make sure it's all up to date.

    I noticed that "Apply Changes & Restart Activity" does not reload the strings.xml. To see the updated strings you must rerun the app.

    (I'm using Android Studio 2021.1.1 Patch 1 on Windows 10.)

  • Hey Gordon,
    I would definitely like changing and saving the settings on the phone. I have gone through 4 or so corruptions and it's painful to remember to change all of the settings. Having it read the settings app on the bangle and then using that to change the settings on the phone sounds like a really really awesome feature.

  • In terms of alarms there is actually an alarm sync thing in Gadgetbridge already

    Is this the ability to set alarms on the watch from the Android alarm app, or to set alarms for the watch from the gadgetbridge app? Because I'm seeing the ability to turn on and set alarm for bangle on the gadgetbridge app, but I would REALLY like the ability for the alarms from the Android app be synced to bangle.

    As usual, easily could be user error...

  • This just went in: https://github.com/espruino/BangleApps/p­ull/2951

    Should be available soon-ish via standard routes, or now if you build Gadgetbridge from source.

    Edit: But I don't think it's integration with the standard Android Alarms, but just the ones in Gadgetbridge.

  • Not sure if this is what I'm talking about or not. Looks like it deals with gadgetbridge alarms being sent to the watch. I'm looking for android clock app alarms to be sent to the watch. I will certainly see if that update is the change I'm looking for, though!

  • Yes, sorry - I don't think it is either. It's a good improvement though!

    And I've also been thinking some about the ability to integrate with standard android alarms. I'm not sure it's trivial to implement though, and whether or not Gadgetbridge does this at all today.

    If you'd like to try, maybe you can come up with something using Tasker? I think it could be possible. Tasker can talk with the bangle via Gadgetbridge and Android intents. So if Tasker can detect changes to the phone's alarms, it should be able to relay that to your Bangle.

  • I'm barely scratching the surface on knowledge of this kind of stuff, but I'm thinking it'll be far more than trivial.

    I'm not familiar with Tasker, but I can look into it and see if I can't figure something out.

  • This sounds promising:

    https://www.reddit.com/r/tasker/comments­/1068zbs/project_share_version_2_wear_os­_30_alarmstimers/

    If they managed to sync alarms from google clock to wear os using tasker it should be possible to tweak it to work with a bangle.

  • If they managed to sync alarms from google clock to wear os

    That looks like a great starting off point! I'll look into that and see what modifications I can do.

  • Okay, so this seems like it has the basic functionality I want. Utilizing tasker and taking code from the "alarm" app, I was able to get the basics of what I want.

    I wrote a task in "tasker" (which cost $3, but I was willing to make that purchase for this), which fires when the Android clock app exits. What it does is looks for the next alarm, then writes that alarm to bangle. This is sent via Android intent. Tasks are:
    Test next alarm
    Send intent

    Send intent looks like this:
    Action: com.banglejs.uart.tx
    Extra: line:var alarm = require("sched").newDefaultAlarm();var time = require("time_utils").decodeTime(alarm.t­);var date = new Date();time.h="%na_time".substring(0,2);­time.m="%na_time".substring(3);date.setD­ate(%na_day);date.setMonth(%na_month-1);­date.setFullYear(%na_year);alarm.on=true­;alarm.t = require("time_utils").encodeTime(time); alarm.last = alarm.t < require("time_utils").getCurrentTimeMill­is() ? new Date().getDate() : 0; if(date) alarm.date = date.toLocalISOString().slice(0,10);var array =[]; array[0] = alarm;require("sched").setAlarms(array);­

    The extra is a mess, so here it is more pretty:

    line: var alarm = require("sched").newDefaultAlarm();
    var time = require("time_utils").decodeTime(alarm.t­);
    var date = new Date();
    time.h = "%na_time".substring(0, 2);
    time.m = "%na_time".substring(3);
    date.setDate( % na_day);
    date.setMonth( % na_month - 1);
    date.setFullYear( % na_year);
    alarm.on = true;
    alarm.t = require("time_utils").encodeTime(time);
    alarm.last = alarm.t < require("time_utils").getCurrentTimeMill­is() ? new Date().getDate() : 0;
    if (date) alarm.date = date.toLocalISOString().slice(0, 10);
    var array = [];
    array[0] = alarm;
    require("sched").setAlarms(array);
    

    This is in no way elegant. It works, at least, but there are some issues I'll try to work on later.

    1. This removes literally everything set for alarms, and overwrites it with only the next set alarm from Android.
    2. It does not currently set alarms for repeat.
    3. It only sets the next alarm, ignoring any alarm after that.

    1 can probably be fixed with some more effort and if/else statements to preserve current alarms, and not set if an alarm is already on at that time. I wrote all of the above code from my phone, which is a pain, so I will look into that one later. Right now, this makes setting alarms from the watch a waste of time, since they get deleted with this currently.
    2 seems to be an issue with tasker/clock app interaction. I can't figure out how to get the repeat data into tasker. There are other clock apps that reportedly work better, but I wanted to see what I can do with the current app.
    3 also seems to be a tasker/clock app thing. Can probably write something to scrape the clock app database and see what other alarms are there. Might also help with 2. Again, don't want to do this on my phone.

    I'll work on this more in the next few days, but wanted to get this written down somewhere so I can show it's possible. If you have any pointers on the code above or my thoughts on the list items, please let me know!

  • Cool to see you got a proof of concept already!

    Also,

    I wrote all of the above code from my phone

    😮😬😅

  • hi, anyone any idea how to control the phone from the watch?

    what i think is, the phone have much more sensors, so it is the base.
    it will sit in my chest's pocket, with either front or rear camera facing my front.
    the mics, +/- headphones will be ON, together with wifi, bluetooth, GPS etc.

    Since i am an AI guy,
    i would like to see the watch either

    1. act as a small window to the android's screen, and allow you to use the watch's screen as touchpad and click (VNC?)

    OR

    1. press a virtual button on watch and call up some apps on the android, esp press a virtual button and call up openai.app or the web version, together with voice input and speaker/headphone output. then i'll have a servant 24x7 for me.


    thank you.

  • ok, just found "intents"
    https://www.espruino.com/Gadgetbridge

    will have a look later.

  • Yes, you can either program all relevant intent info into a Bangle.js app and let Gadgetbridge handle them on the android side. Or you can do with shorter commands from the Bangle.js app and then set up e.g. Tasker to receive and interpret those commands.

    I personally rather go with the first option so it's easily picked up by others that want to use it, but you can probably get away with a lower energy consumption from bluetooth transfers (don't know to what degree) thanks to shorter command strings with the second option.

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

Bangle companion app

Posted by Avatar for Alessandro @Alessandro

Actions