我正在尝试播放铃声,我为我的联系人保存,如下所述
Mringtone = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
Mringtone.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE,
RingtoneManager.TYPE_ALL);
Mringtone.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE,
"Select RingTone");
Mringtone.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI,
(Uri) Uri.parse(SelectedRingTone));
this.startActivityForResult(Mringtone, 0);
在活动结果上,我收到铃声URI并将其保存到我的表
CustomRingToneUri = data.getParcelableExtra(mRingtoneManager.EXTRA_RINGTONE_PICKED_URI);
if (CustomRingToneUri != null) {
int updateRes= getContentResolver().update(URI_MY_TABLE,contactRingTone(CustomRingToneUri.toString()),
"_id = " + "\"" + receivedExtra + "\"", null);
}
所以它按预期正确更新,我正在使用PhoneStateListener接收来电,我正在尝试从我从表中收到的URI播放铃声,如下所示
Uri ConvertedToUri;
ConvertedToUri = Uri.parse(IncomingNumberRingtonePath);
ringTone=ringToneManager.getRingtone(getApplicationContext(), ConvertedToUri);
if (ringTone.isPlaying())
ringTone.stop();
ringTone.play();
如果我接到来电,我会同时播放默认和保存铃声。我也尝试使用 stopPreviousRingTone 。它没有帮助我。请给我一些可行的方法
由于 Venkatraman