Ringtones

The Ringtones API helps get the native ringtones list on devices. And you can also use this API to play or stop the native ringtones and custom ringtones.

Usage
Ringtones.getRingtone(Ringtones.RingtoneType.RINGTONE)
    .then((result) => {
        result.forEach( ring =>{
            console.log(ring.Name,ring.Url);
        });
    })
    .catch((error) => {
        console.error(error);
    });
window.Ringtones.getRingtone(window.Ringtones.RingtoneType.RINGTONE)
    .then((result) => {
        result.forEach((ring) => {
            console.log(ring.Name, ring.Url);
        });
    })
    .catch((error) => {
        console.error(error);
    });
window.Ringtones.getRingtone(window.Ringtones.RingtoneType.RINGTONE)
    .then((result) => {
        result.forEach((ring) => {
            console.log(ring.Name, ring.Url);
        });
    })
    .catch((error) => {
        console.error(error);
    });
(<any>window).Ringtones.getRingtone((window).Ringtones.RingtoneType.RINGTONE)
    .then((result) => {
        result.forEach((ring) => {
            console.log(ring.Name, ring.Url);
        });
    })
    .catch((error) => {
        console.error(error);
    });
window.Ringtones.getRingtone(window.Ringtones.RingtoneType.RINGTONE)
    .then((result) => {
        result.forEach((ring) => {
            console.log(ring.Name, ring.Url);
        });
    })
    .catch((error) => {
        console.error(error);
    });

Classes


Ringtones

getRingtone
getRingtone(type?: RingtoneType): Promise<RingtoneResult >

Get the system ringtone list by type.


PARAMETERS
[optional]type: RingtoneType The default value is 'notification'

RETURN
returns: Promise<RingtoneResult>
playRingtone
playRingtone(ringtoneUri : string): Promise<any>

Play a ringtone by passing the URI of this ringtone.


PARAMETERS
ringtoneUri: string

RETURN
returns: Promise<any>
stopRingtone
stopRingtone(ringtoneUri : string): Promise<any>

Stop a ringtone by passing the URI of this ringtone.


PARAMETERS
ringtoneUri: string

RETURN
returns: Promise<any>

Interfaces Used

RingtoneResult

RingtoneResult {
    Name: String; // Display name
    Url: string;  // File URL
}

Enumerations

RingtoneType

enum RingtoneType {
    NOTIFICATION : 'notification',// Default
    ALARM : 'alarm',
    RINGTONE : 'ringtone'
}