RingtoneManager getRingtone - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for RingtoneManager getRingtone method.

This code example shows how to use the following methods:getRingtone
                        uriForDefaultItem);
            } 
            ringtone = defaultRingtone;
            ringtoneManager.stopPreviousRingtone();
        } else { 
            ringtone = ringtoneManager
                    .getRingtone(getRingtoneManagerPosition(sampleRingtonePos));
        } 
        if (ringtone != null) {
            ringtone.play();
        } 
    } 
 
    private void stopAnyPlayingRingtone() { 
        if (defaultRingtone != null && defaultRingtone.isPlaying()) {
            defaultRingtone.stop();
        } 
        if (ringtoneManager != null) {
            ringtoneManager.stopPreviousRingtone();
        } 
7
CodeRank
This code example shows how to use the following methods:getSystemService, getRingtone
        } 
    } 
 
    private void initAudio() { 
        mAudioManager = (AudioManager) mContext
                .getSystemService(Context.AUDIO_SERVICE);
    } 
 
    private synchronized void ringIncoming() { 
        Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
        int ringerMode = mAudioManager.getRingerMode();
        mVibrator = (Vibrator) mContext
                .getSystemService(Context.VIBRATOR_SERVICE);
        if (mCallInProgress) {
            // Notify with single vibrate. 
            mVibrator.vibrate((long) 200);
        } else { 
            if (AudioManager.RINGER_MODE_NORMAL == ringerMode) {
                mAudioManager.setMode(AudioManager.MODE_RINGTONE);
                ring(uri, AudioManager.STREAM_RING);

7
CodeRank
This code example shows how to use the following methods:getRingtone, getRingtonePosition, setType
        final String s = settings.getRingtone();
        if ((s == null) || "".equals(s)) {
            return; 
        } 
 
        final RingtoneManager manager = new RingtoneManager(this);
        manager.setType(RingtoneManager.TYPE_ALL);
        ringtone = manager.getRingtone(manager.getRingtonePosition(Uri.parse(s)));
        if (ringtone == null) {
            return; 
        } 
 
        // TODO: AnnouncifySettings using ContentProvider 
        ringtone.setStreamType(new AnnouncifySettings(this).getStream());
        ringtone.play();
    } 
 
    protected void stopRingtone() { 
        if (ringtone != null) {
            ringtone.stop();
7
CodeRank
This code example shows how to use the following methods:getRingtone, getRingtonePosition
			playRingtone(ringtone);
		} 
	} 
 
	private Ringtone getDefaultRingtone(Context context) {
		RingtoneManager ringtoneManager = new RingtoneManager(context);
		int position = ringtoneManager
				.getRingtonePosition(Settings.System.DEFAULT_RINGTONE_URI);
		Ringtone ringtone = ringtoneManager.getRingtone(position);
		return ringtone;
	} 
 
	private void playRingtone(Ringtone ringtone) {
		// TODO: Pull this time from settings. 
		int millis = 90000;
		try { 
			ringtone.wait(millis);
		} catch (InterruptedException e) {
			e.printStackTrace();
		} 
5
CodeRank
This code example shows how to use the following methods:getRingtone
This code example shows how to use the following methods:getRingtone
                        uriForDefaultItem);
            } 
            ringtone = defaultRingtone;
            ringtoneManager.stopPreviousRingtone();
        } else { 
            ringtone = ringtoneManager
                    .getRingtone(getRingtoneManagerPosition(sampleRingtonePos));
        } 
        if (ringtone != null) {
            ringtone.play();
        } 
    } 
 
    public RingtonePicker show() { 
        create(); 
        dialog.show();
        return this;
    } 
 
    private void stopAnyPlayingRingtone() { 
5
CodeRank
This code example shows how to use the following methods:getRingtone
This code example shows how to use the following methods:getRingtone
						uriForDefaultItem);
			} 
			ringtone = defaultRingtone;
			ringtoneManager.stopPreviousRingtone();
		} else { 
			ringtone = ringtoneManager
					.getRingtone(getRingtoneManagerPosition(sampleRingtonePos));
		} 
		if (ringtone != null) {
			ringtone.play();
		} 
	} 
 
	public RingtonePicker show() { 
		create(); 
		dialog.show();
		return this;
	} 
 
	private void stopAnyPlayingRingtone() { 
4
CodeRank
This code example shows how to use the following methods:getRingtone
						uriForDefaultItem);
			} 
			ringtone = defaultRingtone;
			ringtoneManager.stopPreviousRingtone();
		} else { 
			ringtone = ringtoneManager
					.getRingtone(getRingtoneManagerPosition(sampleRingtonePos));
		} 
		if (ringtone != null) {
			ringtone.play();
		} 
	} 
 
	public RingtonePicker show() { 
		create(); 
		dialog.show();
		return this;
	} 
 
	private void stopAnyPlayingRingtone() { 
4
CodeRank
This code example shows how to use the following methods:getRingtone
						uriForDefaultItem);
			} 
			ringtone = defaultRingtone;
			ringtoneManager.stopPreviousRingtone();
		} else { 
			ringtone = ringtoneManager
					.getRingtone(getRingtoneManagerPosition(sampleRingtonePos));
		} 
		if (ringtone != null) {
			ringtone.play();
		} 
	} 
 
	private void stopAnyPlayingRingtone() { 
		if (defaultRingtone != null && defaultRingtone.isPlaying()) {
			defaultRingtone.stop();
		} 
		if (ringtoneManager != null) {
			ringtoneManager.stopPreviousRingtone();
		} 
3
CodeRank

Related RingtoneManager getRingtone Questions & Answers:

getRingtone Method Overview
Gets a Ringtone for the ringtone at the given position in the Cursor.
See Code Examples for other Android RingtoneManager Methods: