TikTok for Developers

Developer Docs

Last updated October 5, 2026

Device

Use these APIs for system keyboard input, preferred frame rate, and device vibration feedback.

TT.ShowKeyboard(options, onSuccess, onError)

Shows the system keyboard.

Signature

public static void ShowKeyboard(
    TTKeyboard.ShowKeyboardOptions options,
    Action onSuccess,
    Action<string> onError)

ShowKeyboardOptions

Field

Type

Description

maxLength

int

Maximum number of input characters.

multiple

bool

Whether multiline input is allowed.

confirmHold

bool

Whether the keyboard remains visible after confirmation.

defaultValue

string

Initial input value.

confirmType

string

Keyboard confirmation-button type.

Listen for input, confirmation, and completion through TT.OnKeyboardInput, TT.OnKeyboardConfirm, and TT.OnKeyboardComplete.

Example

TT.OnKeyboardInput += value => Debug.Log($"Input: {value}");
TT.OnKeyboardConfirm += value => Debug.Log($"Confirmed: {value}");

TT.ShowKeyboard(
    new TTKeyboard.ShowKeyboardOptions
    {
        maxLength = 20,
        defaultValue = string.Empty,
        confirmType = "done"
    },
    onSuccess: () => Debug.Log("Keyboard opened."),
    onError: error => Debug.LogError(error)
);

TT.HideKeyboard(onSuccess, onError)

Hides the system keyboard.

Signature

public static void HideKeyboard(Action onSuccess, Action<string> onError)

Example

TT.HideKeyboard(
    onSuccess: () => Debug.Log("Keyboard closed."),
    onError: error => Debug.LogError(error)
);

TT.OnKeyboardInput

Listens for keyboard input changes. Keep the same delegate instance so it can be removed later.

Signature

public static event TTKeyboard.OnKeyboardInputEvent OnKeyboardInput

Example

TTKeyboard.OnKeyboardInputEvent inputListener = value => Debug.Log(value);
TT.OnKeyboardInput += inputListener;
TT.OnKeyboardInput -= inputListener;

TT.OnKeyboardConfirm

Listens for user confirmation of keyboard input.

Signature

public static event TTKeyboard.OnKeyboardConfirmEvent OnKeyboardConfirm

Example

TTKeyboard.OnKeyboardConfirmEvent confirmListener = value => Debug.Log(value);
TT.OnKeyboardConfirm += confirmListener;
TT.OnKeyboardConfirm -= confirmListener;

TT.OnKeyboardComplete

Listens for completion of the keyboard input flow.

Signature

public static event TTKeyboard.OnKeyboardCompleteEvent OnKeyboardComplete

Example

TTKeyboard.OnKeyboardCompleteEvent completeListener = value => Debug.Log(value);
TT.OnKeyboardComplete += completeListener;
TT.OnKeyboardComplete -= completeListener;

TT.SetPreferredFramesPerSecond(fps)

Sets the target frame rate. Actual frame rate still depends on device performance, system scheduling, and game workload.

Signature

public static void SetPreferredFramesPerSecond(int fps)

Example

TT.SetPreferredFramesPerSecond(60);

TT.VibrateShort(param)

Triggers a short device vibration. The parameter object contains Success, Fail, and Complete. The failure callback returns ErrorInfo.

Signature

public static void VibrateShort(VibrateShortParam param)

Example

TT.VibrateShort(new VibrateShortParam
{
    Success = _ => Debug.Log("Vibration succeeded."),
    Fail = error => Debug.LogError(error.ErrMsg),
    Complete = () => Debug.Log("Vibration call completed.")
});

TT.VibrateLong(param)

Triggers a long device vibration.

Signature

public static void VibrateLong(VibrateLongParam param)

Example

TT.VibrateLong(new VibrateLongParam
{
    Success = _ => Debug.Log("Long vibration succeeded."),
    Fail = error => Debug.LogError(error.ErrMsg),
    Complete = () => Debug.Log("Vibration call completed.")
});
TikTok for Developers