Feedback

Defined in package com.scandit.datacapture.core.feedback

Vibration
class Vibration

Added in version 6.0.0

A vibration, to be emitted for example when a code has been successfully scanned.

Vibration()
Vibration()

Added in version 6.0.0

Creates a new Vibration object.

defaultVibration()
fun Vibration.defaultVibration(): Vibration

Added in version 6.0.0

The default vibration for a successful scan.

The duration of vibration is set to 300 milliseconds.

duration
var duration: TimeInterval

Added in version 6.1.0

The duration of the vibration.

amplitude
var amplitude: Int

Added in version 6.15.0

The strength of the vibration. This must be a value between 1 and 255, or VibrationEffect.DEFAULT_AMPLITUDE. This property is used only on Android SDK API level 26 or above. Some values might require higher level of the Android SDK API. See VibrationEffect for details.

toJson()
fun toJson(): String

Added in version 6.10.0

Returns the JSON representation of the vibration.

Sound
abstract class Sound

Added in version 7.0.0

A sound, to be played for example when a code has been successfully scanned.

toJson()
fun toJson(): String

Added in version 7.0.0

Returns the JSON representation of the feedback.

defaultSound()
fun Sound.defaultSound(): Sound

Added in version 7.0.0

The default beep sound for a successful scan.

AssetSound
class AssetSound : Sound

Added in version 6.8.0

A sound created with an asset resource, to be played for example when a code has been successfully scanned.

AssetSound()
AssetSound(assetName: String)

Added in version 6.8.0

Creates a new AssetSound object for the given asset name, file extension should be included.

assetName
val assetName: String

Added in version 7.0.0

Name of the sound asset.

toJson()
fun toJson(): String

Added in version 7.0.0

Returns the JSON representation of the feedback.

ResourceSound
class ResourceSound : Sound

Added in version 6.8.0

A sound created with a raw resource, to be played for example when a code has been successfully scanned.

ResourceSound()
ResourceSound(resourceId: Int)

Added in version 6.8.0

Creates a new ResourceSound object for the given raw resource.

resourceId
val resourceId: Int

Added in version 6.0.0

Id of the sound resource.

toJson()
fun toJson(): String

Added in version 7.0.0

Returns the JSON representation of the feedback.

Feedback
class Feedback

Added in version 6.0.0

A feedback consisting of a sound and vibration, for example to be provided by a device when a code has been successfully scanned.

fromJson(json)
fun Feedback.fromJson(json: String): Feedback

Added in version 6.3.0

Constructs a new feedback with the provided JSON serialization.

defaultFeedback()
fun Feedback.defaultFeedback(): Feedback

Added in version 6.0.0

The default feedback consisting of a default sound and a default vibration.

sound
val sound: Sound?

Added in version 6.0.0

The sound to be played when a feedback is required. If null, no sound is played. Depending on the device’s ring mode and/or volume settings, no sound may be played even if this property is properly set to a non-null instance.

vibration
val vibration: Vibration?

Added in version 6.0.0

The vibration to be emitted when a feedback is required. If null, no vibration is emitted. This property is further influenced by the device’s ring mode: the device may not vibrate even if this property is properly set to a non-null instance.

Feedback()
Feedback()

Added in version 6.0.0

Creates a Feedback that emits no vibration and plays no sound.

Feedback()
Feedback(vibration: Vibration?)

Added in version 6.0.0

Creates a Feedback that emits the given vibration, but plays no sound.

Feedback()
Feedback(sound: Sound?)

Added in version 6.1.0

Creates a Feedback that plays the given sound, but emits no vibration.

Feedback()
Feedback(vibration: Vibration?,
        sound: Sound?)

Added in version 6.0.0

Creates a Feedback that emits the given vibration and plays the given sound.

emit()
fun emit()

Added in version 6.0.0

Emits the feedback defined by this object. This method is further influenced by the device’s ring mode and/or volume settings - check sound and vibration for more details.

emitSound()
fun emitSound()

Added in version 8.2.0

Emits only the sound component of the feedback defined by this object. This method is further influenced by the device’s volume settings - check sound for more details.

emitVibration()
fun emitVibration()

Added in version 8.2.0

Emits only the vibration component of the feedback defined by this object. This method is further influenced by the device’s ring mode - check vibration for more details.

release()
fun release()

Added in version 6.0.0

Frees the resources associated with this feedback instance. This is only required when you are using the feedback instance without a capture mode. When the instance gets used by a capture mode, the resources will automatically be freed when they are no longer required.

toJson()
fun toJson(): String

Added in version 6.10.0

Returns the JSON representation of the feedback.

WaveFormVibration
class WaveFormVibration : Vibration

Added in version 6.16.0

A wave form vibration, to be emitted for example when a code has been successfully scanned.

This form of vibration will only be used on Android SDK API level 26 or above. See VibrationEffect::createWaveForm for details.

If this is used on Android SDK API level 25 or below, it is replaced with simple vibration with duration.

WaveFormVibration()
WaveFormVibration(timings: LongArray)

Added in version 6.16.0

Creates a new WaveFormVibration object with timings.

WaveFormVibration()
WaveFormVibration(timings: LongArray,
        amplitudes: IntArray?)

Added in version 6.16.0

Creates a new WaveFormVibration object with timings and amplitudes.

amplitudes
val amplitudes: IntArray?

Added in version 6.16.0

Returns the amplitudes of the WaveFormVibration.

timings
val timings: LongArray

Added in version 6.16.0

Returns the timings of the WaveFormVibration.

toJson()
fun toJson(): String

Added in version 6.16.0

Returns the JSON representation of the vibration.