How to set the ringtone only for specific application?

92 views Asked by At

I want to select a ringtone and set it as default ringtone for my application but not for the whole mobile device? How could I do it?

//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;
    }
} 

i know how to select a ringtone but i need it to be only called in my app

0

There are 0 answers