Reputation: 4857
My app play ringtone. My code:
RingtoneManager.getRingtone( context, RingtoneManager.getDefaultUri( RingtoneManager.TYPE_NOTIFICATION)).play();
Ringtone play very well. But if ringtone is long I need cut the first N milliseconds from it.
Upvotes: 0
Views: 1477
Reputation: 2438
Just put the RingTone in mediaPlayer for eg
Mediaplayer mp =new MediaPlayer();
uri = RingtoneManager.getDefaultUri( RingtoneManager.TYPE_NOTIFICATION))
mp.setDataSoure(getApplicationContext(), uri);
mp.prepare();
mp.getDuration()
Use the mp.getDuration and do whatever u want. Enjoy
Upvotes: 1