Skip to main content
Version: v3

SystemSounds

Start from API_LEVEL 3.6 . Please refer to API_LEVEL.

Calorie Sensor.

Methods

getEnabled

Get whether the system ringtone function is turned on, and it can only be played after it is turned on

getEnabled(): boolean

getSourceType

Get built-in system ringtone type

getSourceType(): Type

Type

PropertyTypeRequiredDefaultValueDescriptionAPI_LEVEL
ALARMnumberY-Alarm clock reminder3.6
MESSAGEnumberY-Notification sound when receiving text messages or emails3.6
REGULARnumberY-TingTing sound3.6
ACHIEVEnumberY-Goals achieved3.6
CAMERAnumberY-Camera shutter3.6
ABN_HIGHnumberY-Health data measurement abnormalities (high values)3.6
ABN_LOWnumberY-Health data measurement abnormalities (low values)3.6
SOSnumberY-SOS for help3.6

start

Start playing the sound, you can pass in type to specify the ringtone type, repeatCount is the number of audio repetitions, default is 0, do not repeat playback

start(sourceType: number, repeatCount: 0): void

stop

Stop sound playback

stop(): void

Example

import { SystemSounds } from '@zos/sensor'

const systemSounds = new SystemSounds()
const alarmType = systemSounds.getSourceType().ALARM

if (systemSounds.getEnabled()) {
systemSounds.start(alarmType)
}