Can the Bangle 2 make webrequests?

Posted on
  • I bought the first Bangle thinking it'd be very easy to create an app that would send http requests to a web server I wrote so I could easily control stuff.

    I didn't even think to question the assumption that a device like this would be able to make web requests would however when I started and couldn't see an easy way to do so I saw a threads about this missing functionality ( like http://forum.espruino.com/conversations/­343427/)

    Is this available now without having to code companion/bridging apps ?

  • As @fanoush says it's available with the Bangle.js Gadgetbridge app right now - I'll update that thread.

    I've also updated the docs, as with recent Android Integration it's as easy as:

    Bangle.http("https://pur3.co.uk/hello.tx­t").then(data=>{
      console.log("Got ",data);
    });
    
  • Excellent - @Gordon I'm struggling to find anything on for example sending post requests / message body data in the docs, is that possible?

  • I'm afraid there's nothing implemented right now - I really just wanted to get something in there so we could get internet access as soon as possible.

    I've just added something to the Gadgetbridge build (https://github.com/gfwilliams/Gadgetbrid­ge/commit/4cd53fa9b64fa668960e27b03fed07­edb7237240) - but I'm only working on and off this and next week and I don't want to push something live to everyone yet in case it (or other Gadgetbridge changes pulled in at the same time) breaks things and I don't have time to revert it.

    But you could build it yourself or install the attached file - and then you'll need Android Integration 0v15 from the development app store too. After that, stuff like:

    Bangle.http("https://...",{method:"post"­,body:"...",headers:{a:1}}).then(data=>{­
      console.log("Got ",data);
    });
    

    should work.


    1 Attachment

  • What about sending data as GET requests? I haven't tried the feature yet, but I suppose it should work?

    Bangle.http("https://pur3.co.uk/?text=he­llo").then(data=>{
      console.log("Got ",data);
    });
    
  • I believe so, yes

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

Can the Bangle 2 make webrequests?

Posted by Avatar for user147333 @user147333

Actions