Device API
Device API
Vibration
VibrateShort(type, onSuccess, onFail)
Executes a short vibration (15ms).
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
type | VibrateType | - | Vibration intensity (heavy, medium, light) |
onSuccess | Action<VibrateShortResult> | - | Success callback |
onFail | Action<string> | - | Failure callback |
TudadaSDK.Instance.VibrateShort(
type: VibrateType.medium, // heavy, medium, light
onSuccess: (result) => Debug.Log("Vibration executed")
);
VibrateLong(onSuccess, onFail)
Executes a long vibration (400ms).
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
onSuccess | Action<VibrateLongResult> | - | Success callback |
onFail | Action<string> | - | Failure callback |
TudadaSDK.Instance.VibrateLong(
onSuccess: (result) => Debug.Log("Long vibration executed")
);
Keyboard
ShowKeyboard(defaultValue, maxLength, multiple, confirmHold, confirmType, onSuccess, onFail)
Displays the soft keyboard.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
defaultValue | string | - | Default input value |
maxLength | int | - | Maximum input length |
multiple | bool | - | Allow multi-line input |
confirmHold | bool | - | Keep keyboard open after confirm |
confirmType | KeyboardConfirmType | - | Confirm button type |
onSuccess | Action<ShowKeyboardResult> | - | Success callback |
onFail | Action<string> | - | Failure callback |
KeyboardConfirmType Options:
| Value | Description |
|---|---|
done | Done |
next | Next |
search | Search |
go | Go |
send | Send |
TudadaSDK.Instance.ShowKeyboard(
defaultValue: "",
maxLength: 100,
multiple: false,
confirmHold: false,
confirmType: KeyboardConfirmType.done,
onSuccess: (result) => Debug.Log("Keyboard shown")
);
HideKeyboard()
Hides the soft keyboard.
TudadaSDK.Instance.HideKeyboard();
OnKeyboardInput (Event)
Event called when keyboard input changes.
Callback Parameter (KeyboardInputResult):
| Field | Type | Description |
|---|---|---|
value | string | Current input value |
TudadaSDK.OnKeyboardInput += (result) => {
Debug.Log("Input: " + result.value);
};
OnKeyboardConfirm (Event)
Event called when the keyboard confirm button is clicked.
Callback Parameter (KeyboardConfirmResult):
| Field | Type | Description |
|---|---|---|
value | string | Confirmed input value |
TudadaSDK.OnKeyboardConfirm += (result) => {
Debug.Log("Confirm: " + result.value);
};
OnKeyboardComplete (Event)
Event called when keyboard input is complete.
Callback Parameter (KeyboardCompleteResult):
| Field | Type | Description |
|---|---|---|
value | string | Final input value |
TudadaSDK.OnKeyboardComplete += (result) => {
Debug.Log("Complete: " + result.value);
};