This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pebble.h> | |
int main(void) { | |
// setup | |
// start run loop | |
// cleanup | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pebble.h> | |
int main(void) { | |
// setup | |
Window *first_window = window_create(); | |
window_stack_push(first_window, true); | |
// start run loop | |
app_event_loop(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TextLayer *hello_text_layer = text_layer_create(GRect(10, 10, 100, 40)); | |
text_layer_set_text(hello_text_layer, "Hello"); | |
layer_add_child(window_get_root_layer(first_window), text_layer_get_layer(hello_text_layer)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
text_layer_destroy(hello_text_layer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pebble.addEventListener("ready", function (event) { | |
console.log("*** Our JavaScript Running"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pebble.sendAppMessage({ 0: "From JavaScript" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void message_received(DictionaryIterator *iterator, void *context) { | |
char *message = dict_find(iterator, 0)->value->cstring; | |
APP_LOG(APP_LOG_LEVEL_DEBUG, "Got message: %s", message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app_message_register_inbox_received(message_received); | |
app_message_open(app_message_inbox_size_maximum(), 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pebble.addEventListener("ready", function(event) { | |
var request = new XMLHttpRequest(); | |
request.onreadystatechange = function() { | |
if (request.readyState == 4 && request.status == 200) { | |
var firstMin = request.response.match(/class="min">([0-9]+)</)[1]; | |
Pebble.sendAppMessage({ 0: firstMin }); | |
} | |
}; | |
request.open("GET", "http://www.bom.gov.au/vic/forecasts/melbourne.shtml", true); | |
request.send(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pebble.h> | |
static TextLayer *hello_text_layer; | |
static void message_received(DictionaryIterator *iterator, void *context) { | |
char *message = dict_find(iterator, 0)->value->cstring; | |
text_layer_set_text(hello_text_layer, message); | |
text_layer_set_font(hello_text_layer, fonts_get_system_font(FONT_KEY_ROBOTO_BOLD_SUBSET_49)); | |
} |
OlderNewer