Show clock after sending intent?

Posted on
  • I'm trying to make a super simple app that only sends an android intent over bluetooth and then goes to the clock app.

    When uploading to RAM it works as expected, but if I save it to storage as an app and run it from the launcher or Pattern Launcher I get the "Loading..." box in the middle of the screen and it never goes back to the clock app.

    Bluetooth.println("");
    Bluetooth.println(JSON.stringify({
      t:"intent", 
      target:"activity", 
      action:"android.intent.action.VOICE_COMM­AND", 
      flags:["FLAG_ACTIVITY_NEW_TASK"]
    }));
    
    Bangle.showClock();
    
  • Maybe just try:

    setTimeout(function() {
      Bangle.showClock();
    }, 100);
    

    Bangle.showClock(); calls load(), and load() doesn't do anything if called while initialising (so you don't get into boot loops).

  • That works perfectly. Thanks!

    I did try using set timeout before I posted here, but I was only using an empty timeout preceding showClock and didn't have showClock inside the timeout.

  • Do you think this is worth putting on the app loader?

    All it does is start Google Assistant's voice prompt on the phone, but I think it could be convenient for certain scenarios like starting navigation or playing a certain song. Especially when combined with apps like Tasker and the"Navigate In Google Maps With Voice" task that asks for a destination and starts navigation all in one go.

    Maybe it could have a way to activate it in the background from anywhere, like the tap side feature from Light Switch. Or maybe if combined with Tasker it could send intents (set up beforehand) to the watch using the voice prompt that was initiated from the watch, essentially giving you hands free control of the Bangle.

  • Right now I'm using a combination of Light Switch with tap side to unlock and then pattern launcher to launch this new gassist app. Combined with Tasker, Google Routines, and Smart Lock on the Android phone it's actually a fairly seamless experience already. But a system wide way to initiate it on the Bangle might be convenient.

    In order for Google Assistant to use Tasker we need give it the "Write Secure Settings" permission through ADB that can be granted or revoked with a helper app on a PC from the main dev of Tasker here.

    Google Routines needs to be configured with the starters and actions. For me this is done by opening the Google app > profile pic > "Settings" > "Google Assistant" > "Routines".

    Starter is the word or phrase that initiates the task. Action should contain "Run" or "Start" followed by the name of the task in Tasker followed by "in" or "with" + "tasker".

    The Smart Lock can be configured on Android so you don't have to unlock your device when you tell it to start a task.

    I have it drafted up in a new branch right now and can do a PR if anyone else will find it useful.


    1 Attachment

    • Screenshot_2023-06-28-13-18-00-18_680d03679600f7af0b4c700c6b270fe7.jpg
  • It also works for starting apps or running code on your bangle by creating a new task in Tasker and adding a "System" action called "Send Intent" and then fill it out following Gordon's guide here for sending intents from Android -> Bangle.

    I think this capability is amazing to have on the Bangle and just wanted to share in case others weren't aware or hadn't tried using intents yet like me.

  • That's great!

    I think at minimum having an app that started the voice assistant would be good - but as you say for it to be properly useful you'd want it with the pattern launcher.

    I use a clock with 'Clock Info' and a Clock Info that sent the VOICE_COMMAND intent would be really handy. Then it'd just be 2 taps on the clock (1 to select, 1 to run).

    Also worth adding that you could paste something like:

    Bangle.on("tap", function(e) {
      if (e.dir=="front" && e.double) {
        Bluetooth.println("");
        Bluetooth.println(JSON.stringify({
          t:"intent", 
          target:"activity", 
          action:"android.intent.action.VOICE_COMM­AND", 
          flags:["FLAG_ACTIVITY_NEW_TASK"]
        }));
      }
    })
    

    into the Custom Boot Code app so that just by tapping hard-ish on the watch screen twice (even with the watch locked) you can start voice commands

  • Those both sound like really good ideas.

    For the clock I imagine we could use the app icon for the image. Do we need text to go with it?

    I'll start making a settings menu and boot code file for the front tap. I'm not familiar with how to make clock info modules yet.

  • I imagine we could use the app icon for the image. Do we need text to go with it?

    I don't think you need text, no - just supply an empty string. For the image you just want a 2 color image (ideally) so it might be better to just include that in the clockinfo itself

  • I just put what I have so far in a new PR. It's not a clock info yet.

  • The double tap to start is pretty slick.


    1 Attachment

  • In order for Google Assistant to use Tasker we need give it the "Write Secure Settings" ...

    I suggest putting these instructions in a gassist readme in some form.

    Smart app!

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

Show clock after sending intent?

Posted by Avatar for stweedo @stweedo

Actions