Code example for Ringtone

Methods: play, setStreamType

0
			mRingtone = RingtoneManager.getRingtone(this, uri);
 
			if (mRingtone != null) {
				Log.e(CLASS_TAG, "Playing ringtone!");
				//playing on the notification stream - the ringtone stream made troubles on certain phones 
				mRingtone.setStreamType(AudioManager.STREAM_NOTIFICATION);
				mRingtone.play();
 
			} else { 
				Log.e(CLASS_TAG, "Could not play ringtone!");
			} 
 
		} else { 
			Log.e(CLASS_TAG, "Could not play audio file! File unknown!");
		} 
	} 
 
	@Override 
	protected void onPause() { 
		if(mWakeLock.isHeld()){
			mWakeLock.release();