Tizen Developers
Published on Tizen Developers (https://developer.tizen.org)

Home > Development > Guides > Native Application > Device Settings and Systems > Sound and Vibration Feedback

Sound and Vibration Feedback

PUBLISHED 22 Oct 2017

Mobile nativeWearable native

Dependencies

  • Tizen 2.4 and Higher for Mobile
  • Tizen 3.0 and Higher for Wearable

Content

  • Prerequisites
  • Playing Feedback with a Specific Pattern
  • Playing Feedback with a Specific Type and Pattern
  • Checking for Pattern Support

Related Info

  • Feedback API for Mobile Native
  • Feedback API for Wearable Native

You can play feedback with a specific pattern or play it with a specific type and pattern. You can also check whether a specific pattern is supported.

The main features of the Feedback API include:

  • Playing a specific feedback pattern

    You can play a sound or vibrate with a specific pattern, or both.

  • Playing feedback for a specific type and pattern

    You can play a sound and vibrate with a specific type and pattern.

  • Checking for pattern support

    You can determine whether a specific pattern is supported.

You can play a feedback pattern using sound or vibration:

  • Sound management

    You can request the sound-server to play a sound by using the mm-keysound library.

    You can use sound feedback with the feedback_play() or feedback_play_type() function. The attribute for the sound type is FEEDBACK_TYPE_SOUND.

  • Vibration management

    You can request the device to vibrate by using a dbus method call. A haptic monotone or haptic effect is requested to device, based on the vibration data type in the vibration.conf configuration.

    You can use vibration feedback with the feedback_play() or feedback_play_type() function. The attribute for the vibration type is FEEDBACK_TYPE_VIBRATION.

Prerequisites

To use the functions and data types of the Feedback API (in mobile [1] and wearable [2] applications), include the <feedback.h> header file in your application:

#include <feedback.h>

Playing Feedback with a Specific Pattern

To play a sound and vibrate with a specific pattern, use the feedback_play() function.

Internally, the function invokes the sound_play or vibrator_play feedback type. It returns success when the pattern enum is valid.

int ret;
ret = feedback_play(pattern);

The return value defines whether playing the feedback was successful.

Playing Feedback with a Specific Type and Pattern

To play a sound and vibrate with a specific type and pattern, use the feedback_play_type() function.

Internally, the function invokes the sound_play or vibrator_play feedback type. It returns success when the pattern enum is valid.

static int ret;
ret = feedback_play_type(type, pattern);

The return value defines whether playing the feedback was successful.

Checking for Pattern Support

To determine whether a specific pattern is supported for a specific feedback type, use the feedback_is_supported_pattern() function.

Internally, the function invokes the sound_is_supported or vibrator_is_supported feedback type.

static int ret;
bool status;
ret = feedback_is_supported_pattern(type, pattern, &status);

The return value defines whether retrieving the feedback information was successful.


Source URL: https://developer.tizen.org/development/guides/native-application/device-settings-and-systems/sound-and-vibration-feedback

Links:
[1] https://developer.tizen.org/dev-guide/latest/org.tizen.native.mobile.apireference/group__CAPI__SYSTEM__FEEDBACK__MODULE.html
[2] https://developer.tizen.org/dev-guide/latest/org.tizen.native.wearable.apireference/group__CAPI__SYSTEM__FEEDBACK__MODULE.html