Pebble Foundation Classes  0.2.0
C++ for Pebble
AppFocusService

Handling app focus The AppFocusService allows developers to be notified when their apps become visible on the screen. Common reasons your app may be running but not be on screen are: it's still in the middle of launching and being revealed by a system animation, or it is being covered by a system window such as a notification. This service is useful for apps that require a high degree of user interactivity, like a game where you'll want to pause when a notification covers your app window. It can be also used for apps that want to sync up an intro animation to the end of the system animation that occurs before your app is visible. More...

Collaboration diagram for AppFocusService:

Classes

struct  AppFocusHandlers
 

Typedefs

typedef void(* AppFocusHandler) (bool in_focus)
 

Functions

void app_focus_service_subscribe_handlers (AppFocusHandlers handlers)
 
void app_focus_service_subscribe (AppFocusHandler handler)
 
void app_focus_service_unsubscribe (void)
 

Detailed Description

Handling app focus The AppFocusService allows developers to be notified when their apps become visible on the screen. Common reasons your app may be running but not be on screen are: it's still in the middle of launching and being revealed by a system animation, or it is being covered by a system window such as a notification. This service is useful for apps that require a high degree of user interactivity, like a game where you'll want to pause when a notification covers your app window. It can be also used for apps that want to sync up an intro animation to the end of the system animation that occurs before your app is visible.

Typedef Documentation

◆ AppFocusHandler

typedef void(* AppFocusHandler) (bool in_focus)

Callback type for focus events

Parameters
in_focusTrue if the app is gaining focus, false otherwise.

Function Documentation

◆ app_focus_service_subscribe()

void app_focus_service_subscribe ( AppFocusHandler  handler)

Subscribe to the focus event service. Once subscribed, the handler gets called every time the app focus changes.

Note
Calling this function is equivalent to
Out focus events are triggered when a modal window is about to open and cover the app.
In focus events are triggered when a modal window which is covering the app is about to close.
Parameters
handlerA callback to be called on will-focus events.

◆ app_focus_service_subscribe_handlers()

void app_focus_service_subscribe_handlers ( AppFocusHandlers  handlers)

Subscribe to the focus event service. Once subscribed, the handlers get called every time the app gains or loses focus.

Parameters
handlerHandlers which will be called on will-focus and did-focus events.
See also
AppFocusHandlers

◆ app_focus_service_unsubscribe()

void app_focus_service_unsubscribe ( void  )

Unsubscribe from the focus event service. Once unsubscribed, the previously registered handlers will no longer be called.

app_focus_service_subscribe_handlers
void app_focus_service_subscribe_handlers(AppFocusHandlers handlers)
AppFocusHandlers
Definition: pebble.h:506