• Hi again @Gordon!
    I just opened a PR on codeberg. It works for opening spotify and playing a song like I wanted in the opening post. I've tried to make it reliable and useful for general use as well. I have not managed to implement targeting of background services yet, but I don't think it should be impossible.

    One thing to watch out for is to make sure it'll still work when things like package/etc aren't supplied.

    I think I've managed that.

    I've been testing my changes to Gadgetbridge with the Bangle.js 2 app attached to this reply. I've attached a gadgetbridge apk with the changes as well.

    testintents.app.js code:

    function leftTouch() { Bluetooth.println(JSON.stringify({t:"int­ent", action:"android.intent.action.VIEW", category:"android.intent.category.DEFAUL­T", package:"com.spotify.music", data:"spotify:track:7lD7gxCk2Pt4lUmCZSWi­MY", target:"Activity", extra:{key1:"asdfas"}}));
    }
    
    function middleTouch() { Bluetooth.println(JSON.stringify({t:"int­ent", action:"android.intent.action.VIEW", category:"android.intent.category.DEFAUL­T", class:"com.spotify.music", data:"spotify:track:7lD7gxCk2Pt4lUmCZSWi­MY", target:"Service", extra:{key1:"asdfas"}}));
    }
    
    function rightTouch() {
      Bluetooth.println(JSON.stringify({t:"int­ent",action:"com.junkbulk.amazfitbipbutt­onmaster.A",extra:{key1:"asdfas"}}));
    }
    
    function touchHandler(button, xy) {
    if (xy.x < Bangle.appRect.w / 3) {leftTouch();}
      else if (xy.x < Bangle.appRect.w * 2 / 3) {middleTouch();}
      else {rightTouch();}
    }
    
    g.clear();
    
    Bangle.setUI({
      mode: 'custom',
      back: () => {load();},
      touch: touchHandler
    });
    

    3 Attachments

About

Avatar for Ganblejs @Ganblejs started