Class Feedback
Definition
- Assembly:
- Tizen.System.Feedback.dll
The Feedback API provides functions to control haptic and sound. The Feedback API provides the way to play and stop feedback, and get the information whether a specific pattern is supported. Below is the supported pattern string: Tap SoftInputPanel Key0 Key1 Key2 Key3 Key4 Key5 Key6 Key7 Key8 Key9 KeyStar KeySharp KeyBack Hold HardwareKeyPressed HardwareKeyHold Message Email WakeUp Schedule Timer General PowerOn PowerOff ChargerConnected ChargingError FullyCharged LowBattery Lock UnLock VibrationModeAbled SilentModeDisabled BluetoothDeviceConnected BluetoothDeviceDisconnected ListReorder ListSlider VolumeKeyPressed
C#Copypublic class Feedback
- Inheritance
-
objectFeedback
Examples
CopyFeedback feedback = new Feedback(); bool res = feedback.IsSupportedPattern(FeedbackType.Vibration, "Tap");
Constructors
Declaration
C#Copypublic Feedback()
Remarks
Initializes a new instance of the Feedback class and prepares the feedback system for use. This constructor initializes the underlying feedback system. It must be called before using any other Feedback methods.
Examples
CopyFeedback feedback = new Feedback();
Exceptions
| Type | Condition |
|---|---|
| System.NotSupportedException | Thrown when failed because the devices (vibration and sound) are not supported. |
| System.InvalidOperationException | Thrown when failed because of a system error. |
Methods
Declaration
C#Copyprotected ~Feedback()
Remarks
Finalizes an instance of the Feedback class and releases associated resources. This destructor ensures proper cleanup of the feedback system resources when the Feedback object is no longer needed.
IsSupportedPattern(FeedbackType, string)
Gets the supported information about a specific feedback type and pattern.
Declaration
C#Copypublic bool IsSupportedPattern(FeedbackType type, string pattern)
Parameters
| Type | Name | Description |
|---|---|---|
| FeedbackType | type | The feedback type. |
| string | pattern | The feedback pattern string. |
Returns
| Type | Description |
|---|---|
| bool | Information whether a pattern is supported. |
Remarks
Now, IsSupportedPattern is not working for FeedbackType.All. This API is working for FeedbackType.Sound and FeedbackType.Vibration only. If you use FeedbackType.All for type parameter, this API will throw ArgumentException. To get the supported information for Vibration type, the application should have http://tizen.org/privilege/haptic privilege.
Examples
CopyFeedback feedback = new Feedback(); bool res = feedback.IsSupportedPattern(FeedbackType.Vibration, "Tap");
Exceptions
| Type | Condition |
|---|---|
| System.Exception | Thrown when failed because the feedback is not initialized. |
| System.ArgumentException | Thrown when failed because of an invalid argument. |
| System.NotSupportedException | Thrown when failed because the device (haptic, sound) is not supported. |
| System.UnauthorizedAccessException | Thrown when failed because the access is not granted (No privilege). |
| System.InvalidOperationException | Thrown when failed because of a system error. |
See Also
Play(FeedbackType, string)
Plays specific type of reactions that are pre-defined feedback pattern.
Declaration
C#Copypublic void Play(FeedbackType type, string pattern)
Parameters
| Type | Name | Description |
|---|---|---|
| FeedbackType | type | The feedback type. |
| string | pattern | The feedback pattern string. |
Remarks
To play Vibration type, app should have http://tizen.org/privilege/haptic privilege. The pattern must be one of the predefined patterns and supported.
Examples
CopyFeedback feedback = new Feedback(); feedback.Play(FeedbackType.All, "Tap");
Exceptions
| Type | Condition |
|---|---|
| System.Exception | Thrown when failed because feedback is not initialized. |
| System.ArgumentException | Thrown when failed because of an invalid arguament. |
| System.NotSupportedException | Thrown when failed because the device (haptic, sound) or a specific pattern is not supported. |
| System.UnauthorizedAccessException | Thrown when failed because the access is not granted(No privilege) |
| System.InvalidOperationException | Thrown when failed because of a system error. |
Declaration
C#Copypublic void Stop()
Remarks
To stop vibration, the application should have http://tizen.org/privilege/haptic privilege.
Examples
CopyFeedback Feedback1 = new Feedback(); Feedback1.Stop();
Exceptions
| Type | Condition |
|---|---|
| System.Exception | Thrown when failed because the feedback is not initialized. |
| System.ArgumentException | Thrown when failed because of an invalid arguament |
| System.NotSupportedException | Thrown when failed because the device (haptic, sound) or a specific pattern is not supported. |
| System.UnauthorizedAccessException | Thrown when failed because the access is not granted (No privilege). |
| System.InvalidOperationException | Thrown when failed because of a system error. |