Send Data to Database from Bangle.js Watch

Posted on
  • I'm new to developing on the bangle.js watch. I've got an app to a spot where I'd like to store data and update a website. I've been looking at storage options and I understand how I can store data on the watch, and also on an exportable csv... but is there a way for me to programmatically write to a database?

    End goal:

    Watch button gets clicked.
    Log gets created in database.
    Website is updated from log.

    Your help is much appreciated.

    Thank you,
    Ben

  • Hi Ben,

    There's no inbuilt database in Bangle.js, just files.

    What data did you want to store in this database?

    What I'd suggest is you use the require("Storage").open("file.csv","a").­write("some data\n"); that you already came across to append the data each time the watch button is pressed.

    Then when you're in contact with the website, you upload the contents of that file and then erase it, so next time you do it you're only uploading the stuff that changed since last time.

  • @Gordon, thank you for getting back to me. I have been playing around with all the features and I believe I figured out how to do what I wanted to do after reviewing your "data streaming" example :)

    Thank you!

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

Send Data to Database from Bangle.js Watch

Posted by Avatar for Ben_Newell @Ben_Newell

Actions