Hi, I'm doing a fake call app and I do not know how to use the default call tone that the phone has, I'm using uri to save the audio that the user of his music chooses, I just need the default tone
prefs=getSharedPreferences("MisPreferencias",this.MODE_PRIVATE);
urimp3 = prefs.getString("urime",null);
if(urimp3==null)
{
urim=Uri.parse("android.resource://"+getPackageName()+"/raw/mp3");
}
else{
urim=Uri.parse(urimp3);
}
SharedPreferences.Editor editor = prefs.edit();
editor.putString("urime",urim.toString());
editor.apply();
mPlayer = new MediaPlayer();
mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
try {
mPlayer.setDataSource(getApplicationContext(), urim);
} catch (IllegalArgumentException e) {
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
} catch (SecurityException e) {
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
} catch (IllegalStateException e) {
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
} catch (IOException e) {
e.printStackTrace();
}
try {
mPlayer.prepare();
} catch (IllegalStateException e) {
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
} catch (IOException e) {
Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
}
mPlayer.setLooping(true);