Native Ringtones

Contents

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).

https://github.com/TongZhangzt/cordova-plugin-native-ringtones

Ionic 手机铃声 Native Ringtones插件的安装(Installation)

ionic cordova plugin add cordova-plugin-native-ringtones npm install @ionic-native/native-ringtones

Ionic 手机铃声 Native Ringtones插件支持的平台(Supported Platforms)

  • Android
  • iOS

Ionic 手机铃声 Native Ringtones插件的用法(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');