In my iOS App i want to send an message to the watch like this:
NSMutableDictionary *message = @{@(1): @(1),
@(2): @"The String"}
[_watch appMessagesPushUpdate:message onSent:^(PBWatch *watch, NSDictionary *update, NSError *error) {
if (error != nil)
NSLog(@"Error sending message: %@", error);
}];
If i am sending it like this it works. But if my string is longer or if i add more than 3 or 4 keys to the dictionary the message will not be delivered. Error is "the app did not acknowledge the message in time".
In my pebble App i do the following:
static void message_handler(DictionaryIterator *iter, void *context) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Received message.");
Tuple *msg_type_tuple = dict_find(iter, PebbleMessageKeyType);
Tuple *msg_value_tuple = dict_find(iter, PebbleMessageKeyValue);
write_line_on_screen(msg_value_tuple->value->cstring);
}
...
// Set sniff interval.
app_comm_set_sniff_interval(SNIFF_INTERVAL_NORMAL);
// Register message handlers
app_message_register_inbox_received(message_handler);
app_message_register_inbox_dropped(message_dropped);
// Init buffers
app_message_open(app_message_inbox_size_maximum(), app_message_outbox_size_maximum());
APP_LOG(APP_LOG_LEVEL_DEBUG, "App Message set up.");
My thought is that it has something to do with the message size. But i can´t imagine that messages can only be so small? In the ToDo list example i saw that they used app_message_open with values 64 for inbox and 16 for outbox parameter. What units are meant with this? 64 characters? How do i know on the iOS side how big my message will be when it arrives on the pebble?