react-nativepush-notificationringtone

How to get System ringtones/sounds


How can i get the list of system ringtones or storage ringtones/sounds in react native e.g ring tones, notification tones, so that i can give users choice to set them as notification tone?

I've searched some libraries but it didn't work


Solution

  • You can use this module if you are using Android. react-native-ringtone-manager

    But it only use Android not ios

    Usage

    import RingtoneManager from 'react-native-ringtone-manager';
    ...
    getRings() {
     this.rings =  RingtoneManager.getRingtones(RingtoneManager.TYPE_ALL);
     if(this.rings != null) {this.rings = this.rings.map((data,index) =>{<Text>{data.title}</Text>})};
    }