Sound and Vibration Feedback
You can play sound and vibration feedback with a specific pattern.
The main features of the Tizen.System.Feedback
class are:
-
Playing a specific feedback pattern
You can play a sound or vibrate with a specific pattern, or both. For a list of supported feedback patterns, see the Tizen.System.Feedback class reference.
-
Checking for pattern support
You can determine whether a specific pattern is supported for a given feedback type.
Prerequisites
To enable your application to use the feedback functionality:
-
To use vibration feedback, the application has to request permission by adding the following privilege to the
tizen-manifest.xml
file:XMLCopy<privileges> <privilege>http://tizen.org/privilege/haptic</privilege> </privileges>
-
To use the methods and properties of the
Tizen.System.Feedback
class, include the Tizen.System namespace in your application:C#Copyusing Tizen.System;
Play feedback with a specific type and pattern
To play a specific feedback pattern with a specific feedback type, follow these steps:
-
Create a new instance of the Tizen.System.Feedback class:
C#CopyFeedback feedback = new Feedback();
-
Play the feedback with the
Play()
method of theTizen.System.Feedback
class. As parameters, enter the feedback type (defined by the Tizen.System.FeedbackType enumeration), and a string to denote the pattern to be played:C#Copyfeedback.Play(FeedbackType.Sound, "Tap");
-
To stop the feedback, use the
Stop()
method:C#Copyfeedback.Stop();
Check for pattern support
To determine whether a specific pattern is supported for a specific feedback type, use the IsSupportedPattern()
method of the Tizen.System.Feedback class:
C#
Copy
bool support;
Feedback feedback = new Feedback();
support = feedback.IsSupportedPattern(FeedbackType.Vibration, "Key0");
The return value defines whether the pattern is supported for the feedback type.
Related information
- Dependencies
- Tizen 4.0 and Higher