Skip to content
This repository has been archived by the owner on May 29, 2023. It is now read-only.

Latest commit

 

History

History
202 lines (120 loc) · 4.55 KB

README.md

File metadata and controls

202 lines (120 loc) · 4.55 KB

capacitor-plugin-audio-toggle

Capacitor plugin for audio mode toggle

Install

npm install capacitor-plugin-audio-toggle
npx cap sync

API

enable()

enable() => Promise<void>

disable()

disable() => Promise<void>

reset()

reset() => Promise<void>

selectDevice(...)

selectDevice(data: { device: DeviceName; }) => Promise<void>
Param Type
data { device: DeviceName; }

setRingtoneMode()

setRingtoneMode() => Promise<void>

getAvailableDevices()

getAvailableDevices() => Promise<{ earpiece: boolean; speakerphone: boolean; wired: boolean; bluetooth: boolean; }>

Returns: Promise<{ earpiece: boolean; speakerphone: boolean; wired: boolean; bluetooth: boolean; }>


getSelectedDevice()

getSelectedDevice() => Promise<{ selectedDevice: DeviceName; }>

Returns: Promise<{ selectedDevice: DeviceName; }>


checkPermissions()

checkPermissions() => Promise<{ granted: boolean; }>

Returns: Promise<{ granted: boolean; }>


requestPermissions()

requestPermissions() => Promise<{ granted: boolean; }>

Returns: Promise<{ granted: boolean; }>


isBluetoothEnabled()

isBluetoothEnabled() => Promise<{ enabled: boolean; }>

Returns: Promise<{ enabled: boolean; }>


openBluetoothSettings()

openBluetoothSettings() => Promise<void>

openAppSettings()

openAppSettings() => Promise<void>

addListener('onChanges', ...)

addListener(eventName: 'onChanges', listenerFunc: (data: { earpiece: boolean; speakerphone: boolean; wired: boolean; bluetooth: boolean; selectedDevice: DeviceName; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param Type
eventName 'onChanges'
listenerFunc (data: { earpiece: boolean; speakerphone: boolean; wired: boolean; bluetooth: boolean; selectedDevice: DeviceName; }) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


removeAllListeners()

removeAllListeners() => Promise<void>

Interfaces

PluginListenerHandle

Prop Type
remove () => Promise<void>

Type Aliases

DeviceName

'earpiece' | 'speakerphone' | 'wired' | 'bluetooth'