WatchFaceEditorContract

public class WatchFaceEditorContract extends ActivityResultContract


An ActivityResultContract for invoking a watch face editor. Note watch face editors are invoked by SysUI and the normal activity result isn't used for returning EditorState because Activity.onStop isn't guaranteed to be called when SysUI UX needs it to. Instead EditorState is broadcast by the editor usingEditorSession.close, to observe these broadcasts use WatchFaceControlClient.getEditorServiceClient and EditorServiceClient.addListener.

Summary

Constants

static final @NonNull String

Public constructors

Public methods

@NonNull Intent

Create an intent that can be used for android.app.Activity.startActivityForResult.

void
parseResult(int resultCode, Intent intent)

Convert result obtained from android.app.Activity.onActivityResult to O.

Inherited methods

From androidx.activity.result.contract.ActivityResultContract
ActivityResultContract.SynchronousResult<Unit>
getSynchronousResult(
    @NonNull Context context,
    @NonNull EditorRequest input
)

An optional method you can implement that can be used to potentially provide a result in lieu of starting an activity.

Constants

ACTION_WATCH_FACE_EDITOR

public static final @NonNull String ACTION_WATCH_FACE_EDITOR

Public constructors

WatchFaceEditorContract

Added in 1.0.0
public WatchFaceEditorContract()

Public methods

createIntent

Added in 1.0.0
public @NonNull Intent createIntent(@NonNull Context context, @NonNull EditorRequest input)

Create an intent that can be used for android.app.Activity.startActivityForResult.

parseResult

Added in 1.0.0
public void parseResult(int resultCode, Intent intent)

Convert result obtained from android.app.Activity.onActivityResult to O.