pebble/devsite/source/_guides/user-interfaces/app-exit-reason.md
2025-02-24 18:58:29 -08:00

1.8 KiB

title description guide_group order related_docs
App Exit Reason Details on how to use the AppExitReason API user-interfaces 1
AppExitReason

Introduced in SDK v4.0, the AppExitReason API allows developers to provide a reason when terminating their application. The system uses these reasons to determine where the user should be sent when the current application terminates.

At present there are only 2 AppExitReason states when exiting an application, but this may change in future updates.

APP_EXIT_NOT_SPECIFIED

This is the default state and when the current watchapp terminates. The user is returned to their previous location. If you do not specify an AppExitReason, this state will be used automatically.

static void prv_deinit() {
    // Optional, default behavior
    // App will exit to the previous location in the system
    app_exit_reason_set(APP_EXIT_NOT_SPECIFIED);
}

APP_EXIT_ACTION_PERFORMED_SUCCESSFULLY

This state is primarily provided for developers who are creating one click action applications. When the current watchapp terminates, the user is returned to the default watchface.

static void prv_deinit() {
    // App will exit to default watchface
    app_exit_reason_set(APP_EXIT_ACTION_PERFORMED_SUCCESSFULLY);
}