pebble
  • Tutorials
  • Get the SDK
  • Guides
  • Documentation
  • Examples
  • Community
  • Blog
  • More
Privacy
Cookies
Publish

Pebble C API

  • Pebble C API
  • Pebble JavaScript API
  • PebbleKit JS
  • PebbleKit iOS
  • PebbleKit Android
  • Foundation
    • App
    • App Communication
    • App Glance
    • AppMessage
    • AppSync
    • AppWorker
    • DataLogging
    • DataStructures
      • UUID
    • Dictation
    • Dictionary
    • Event Service
      • AccelerometerService
      • AppFocusService
      • BatteryStateService
      • CompassService
      • ConnectionService
      • HealthService
      • TickTimerService
    • Exit Reason
    • Internationalization
    • Launch Reason
    • Logging
    • Math
    • Memory Management
    • Platform
    • Resources
      • File Formats
    • Storage
    • Timer
    • Wakeup
    • Wall Time
    • WatchInfo
    • Rocky
  • Graphics
    • Draw Commands
    • Drawing Paths
    • Drawing Primitives
    • Drawing Text
    • Fonts
    • Graphics Context
    • Graphics Types
      • Color Definitions
  • User Interface
    • Animation
      • PropertyAnimation
    • Clicks
    • Layers
      • ActionBarLayer
      • BitmapLayer
      • MenuLayer
      • RotBitmapLayer
      • ScrollLayer
      • SimpleMenuLayer
      • StatusBarLayer
      • TextLayer
    • Light
    • Preferences
    • UnobstructedArea
    • Vibes
    • Window
      • ActionMenu
      • NumberWindow
    • Window Stack
  • Standard C
    • Format
    • Locale
    • Math
    • Memory
    • String
    • Time

App Glance

API for the application to modify its glance.

Data Structure Documentation

struct AppGlanceSlice

An app's glance can change over time as defined by zero or more app glance slices that each describe the state of the app glance at a particular point in time. Slices are displayed in the order they are added, and they are removed at the specified expiration time.

Data Fields

struct AppGlanceSlice::@9 layout

Describes how the slice should be visualized in the app's glance in the launcher.

time_t expiration_time

The UTC time after which this slice should no longer be shown in the app's glance. Use APP_GLANCE_SLICE_NO_EXPIRATION if the slice should never expire.

Enum Documentation

enum AppGlanceResult

Bitfield enum describing the result of trying to add an AppGlanceSlice to an app's glance.

Enumerators

APP_GLANCE_RESULT_SUCCESS

The slice was successfully added to the app's glance.

APP_GLANCE_RESULT_INVALID_TEMPLATE_STRING

The subtitle_template_string provided in the slice was invalid.

APP_GLANCE_RESULT_TEMPLATE_STRING_TOO_LONG

The subtitle_template_string provided in the slice was longer than 150 bytes.

APP_GLANCE_RESULT_INVALID_ICON

The icon provided in the slice was invalid.

APP_GLANCE_RESULT_SLICE_CAPACITY_EXCEEDED

The provided slice would exceed the app glance's slice capacity.

APP_GLANCE_RESULT_EXPIRES_IN_THE_PAST

The expiration_time provided in the slice expires in the past.

APP_GLANCE_RESULT_INVALID_SESSION

The AppGlanceReloadSession provided was invalid.

Typedef Documentation

typedef struct AppGlanceReloadSession AppGlanceReloadSession
typedef uint32_t PublishedId

The ID of a published app resource defined within the publishedMedia section of package.json.

  • SDK 3
  • SDK 4
typedef void(* AppGlanceReloadCallback)(AppGlanceReloadSession *session, size_t limit, void *context)

User-provided callback for reloading the slices in the app's glance.

Parameters

session

A session variable that must be passed to app_glance_add_slice when adding slices to the app's glance; it becomes invalid when the AppGlanceReloadCallback returns

limit

The number of entries that can be added to the app's glance

context

User-provided context provided when calling app_glance_reload()

typedef void(* AppGlanceReloadCallback)(AppGlanceReloadSession *session, size_t limit, void *context)

User-provided callback for reloading the slices in the app's glance.

Parameters

session

A session variable that must be passed to app_glance_add_slice when adding slices to the app's glance; it becomes invalid when the AppGlanceReloadCallback returns

limit

The number of entries that can be added to the app's glance

context

User-provided context provided when calling app_glance_reload()

Macro Definition Documentation

  • SDK 3
  • SDK 4
#define app_glance_add_slice ( session, slice)

Add a slice to the app's glance. This function will only succeed if called with a valid AppGlanceReloadSession that is provided in an AppGlanceReloadCallback, which cannot happen on SDK 3, so it will always return APP_GLANCE_RESULT_INVALID_SESSION.

Parameters

session

The session variable provided in an AppGlanceReloadCallback

slice

The slice to add to the app's glance

Returns

The result of trying to add the slice to the app's glance

#define AppGlanceResult app_glance_add_slice (AppGlanceReloadSession * session, AppGlanceSlice slice)

Add a slice to the app's glance. This function will only succeed if called with a valid AppGlanceReloadSession that is provided in an AppGlanceReloadCallback.

Parameters

session

The session variable provided in an AppGlanceReloadCallback

slice

The slice to add to the app's glance

Returns

The result of trying to add the slice to the app's glance

  • SDK 3
  • SDK 4
#define app_glance_reload ( callback, context)

Clear any existing slices in the app's glance and trigger a reload via the provided callback. Does nothing on SDK 3.

Parameters

callback

A function that will be called to add new slices to the app's glance; even if the provided callback is NULL, any existing slices will still be cleared from the app's glance

context

User-provided context that will be passed to the callback

#define void app_glance_reload (AppGlanceReloadCallback callback, void * context)

Clear any existing slices in the app's glance and trigger a reload via the provided callback.

Parameters

callback

A function that will be called to add new slices to the app's glance; even if the provided callback is NULL, any existing slices will still be cleared from the app's glance

context

User-provided context that will be passed to the callback

#define APP_GLANCE_SLICE_NO_EXPIRATION ((time_t)0)

Can be used for the expiration_time of an AppGlanceSlice so that the slice never expires.

#define APP_GLANCE_SLICE_DEFAULT_ICON ((PublishedId)0)

Can be used for the icon of an AppGlanceSlice so that the slice displays the app's default icon.

Need some help?

Data Structures

  • AppGlanceSlice

Enums

  • AppGlanceResult

Typedefs

  • AppGlanceReloadSession
  • PublishedId
  • AppGlanceReloadCallback

Macro Defintions

  • app_glance_add_slice
  • app_glance_reload
  • APP_GLANCE_SLICE_NO_EXPIRATION
  • APP_GLANCE_SLICE_DEFAULT_ICON

Getting Help

Do you have questions about the Pebble SDK?

Do you need some help understanding something on this page?

You can either take advantage of our awesome developer community and check out the SDK Help forums, or you can send us a message through the website!