Question

Is it possible to retrieve the Do Not Disturb settings within a Pebble watch face? I want to know when my watch face should stop notifying the user, but only when DND is on. I assume it's also possible to get the 24/12 hour mode too?

Was it helpful?

Solution

It looks like you cannot currently access the Do Not Disturb setting:

I was wondering if it was possible to access some of the user choices made in the Settings menu of the Pebble. I'm particularly interested in the Notifications/Do not disturb settings so I can prevent my app to vibrate when the user doesn't want to receive any notification.

Not at present, no. You should suggest it here: http://pages.getpebble.com/pages/suggestions so that Team Pebble know that lots of developers want it.

It might be worthwhile for you to add follow that advice and suggest it to Pebble. If enough of us ask for it we may eventually get it.

As for the 12 / 24 hour preference, you can use bool clock_is_24_style() as shown in the feature_clock_mode sample watchapp:

static void init() {
  window = window_create();
  window_stack_push(window, true /* Animated */);

  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_frame(window_layer);
  text_layer = text_layer_create((GRect){ .origin = { 0, 30 }, .size = bounds.size });

  // Here you go!
  text_layer_set_text(text_layer, clock_is_24h_style() ? "Mode:\n24" : "Mode:\n12");

  text_layer_set_font(text_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_LIGHT));
  text_layer_set_text_alignment(text_layer, GTextAlignmentCenter);
  layer_add_child(window_layer, text_layer_get_layer(text_layer));
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top