Native Ringtonesβ
This plugin is still in beta stage and may not work as expected. Please submit any issues to the plugin repo.
The plugin helps get the native ringtones list on Android or IOS devices. And you can also use this plugin to play or stop the native ringtones and custom ringtones(added in the www folder).
Repo: https://github.com/TongZhangzt/cordova-plugin-native-ringtones
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-plugin-native-ringtones $ npm install --save @ionic-native/native-ringtones@4
- Add this plugin to your app's module
Supported platforms
- Android
- iOS
Usage
import { NativeRingtones } from '@ionic-native/native-ringtones';
constructor(private ringtones: NativeRingtones) { }
...
this.ringtones.getRingtone().then((ringtones) => { console.log(ringtones); });
this.ringtones.playRingtone('assets/ringtones/sound_1.caf');
this.ringtones.stopRingtone('assets/ringtones/sound_1.caf');
Instance Members
getRingtone()
Get the ringtone list of the device
Returns: Promise<any>
Returns a promise that resolves when ringtones found successfully
playRingtone(ringtoneUri)
This function starts playing the ringtone
Param | Type | Details |
---|---|---|
ringtoneUri |
string
|
The path to the ringtone file |
Returns: Promise<any>
Returns a promise
stopRingtone(ringtoneUri)
This function stops playing the ringtone
Param | Type | Details |
---|---|---|
ringtoneUri |
string
|
The path to the ringtone file |
Returns: Promise<any>
Returns a promise