如何仅为特定应用设置铃声?

时间:2016-12-30 19:26:39

标签: android ringtone

我想选择一个铃声并将其设置为我的应用程序的默认铃声,但不是整个移动设备?我怎么能这样做?

//fetch default Ringtone
        Ringtone defaultRingtone = RingtoneManager.getRingtone(getActivity(), 
                                       Settings.System.DEFAULT_RINGTONE_URI);
        //fetch current Ringtone
        Uri currentRintoneUri = RingtoneManager.getActualDefaultRingtoneUri(getActivity()
                .getApplicationContext(), RingtoneManager.TYPE_RINGTONE);
        Ringtone currentRingtone = RingtoneManager.getRingtone(getActivity(), currentRintoneUri);
        //display Ringtone title
        output.setText(defaultRingtone.getTitle(getActivity())+" and " +
                "Current Ringtone:"+currentRingtone.getTitle(getActivity()));
        //play current Ringtone
        currentRingtone.play();
        return view;
    }
} 

我知道如何选择铃声,但我只需要在我的应用中调用

0 个答案:

没有答案