'How to use platform's preinstalled ringtone in Cordova?

I wanna use system's preinstalled ringtone and alarm in iOS/Android platform of Cordova.

I used cordova-plugin-native-ringtone, but it's only use preinstalled notification sounds.

How can I get ringtone and alarm list and use?

I should make plugin?



Solution 1:[1]

If you want to get the ringtone or alarm list, you need to call the getRingtones with the 3rd optional parameter (only works for Android). Here is an example for ringtone:

cordova.plugins.NativeRingtones.getRingtone(function(ringtoneList) {
    ringtones = ringtoneList;
},
function(err) {
    alert(err);
}, 'ringtone');

If you want the alarm list, pass 'alarm' instead of 'ringtone'

Solution 2:[2]

the problem is in NativeRingtones.java from but I think it's too late

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 BShaps
Solution 2 Juanjo3299