user3330557 user3330557 - 13 days ago 4
Javascript Question

Pebble: JavaScript Send Data from Server to Pebble

I am trying to parse data from an API to my pebble but I don't know how to proceed. Was browsing through pebble development and they say JavaScript is a good gateway and I can make HTTP requests but I don't know JS.

What do I need in my .c file and what do I need in my .JS file?

Thanks!

Answer

The quotes example is really simple and probably very close to what you want to do. I would start there:

  • On the JavaScript side, you will make your request to the webservice, check the response is ok and then just send the elements that you are interested in to the Pebble (with Pebble.sendAppMessage().

  • On the Pebble side, you initialize AppMessage in your init() function and then declare a handler that will be called every time a message is received (in_received_handler in this example). That handler will update the information on the screen.

Comments