當前位置: 首頁>>代碼示例>>Java>>正文


Java RingtoneManager.getActualDefaultRingtoneUri方法代碼示例

本文整理匯總了Java中android.media.RingtoneManager.getActualDefaultRingtoneUri方法的典型用法代碼示例。如果您正苦於以下問題:Java RingtoneManager.getActualDefaultRingtoneUri方法的具體用法?Java RingtoneManager.getActualDefaultRingtoneUri怎麽用?Java RingtoneManager.getActualDefaultRingtoneUri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.media.RingtoneManager的用法示例。


在下文中一共展示了RingtoneManager.getActualDefaultRingtoneUri方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.media.RingtoneManager; //導入方法依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();

    mNotificationTitle = getString(R.string.service_name);

    // Dump some debugging information to the logs
    Log.i(TAG, START_LINPHONE_LOGS);

    dumpDeviceInformation();
    dumpInstalledSipSerivceInformation();

    loadNativeLibraries();

    if (SharedPreferencesUtil.getRingtone(this) == "") {
        mRingtoneUri = RingtoneManager.getActualDefaultRingtoneUri(SipService.this, RingtoneManager.TYPE_RINGTONE);
    } else {
        mRingtoneUri = Uri.parse(SharedPreferencesUtil.getRingtone(this));
    }

    mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
    mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

    mEchoMode = SharedPreferencesUtil.getEchoCancellationMode(this);
    mEchoAggressiveness = SharedPreferencesUtil.getEchoCancellationAggressiveness(this);
    mEchoTailLength = SharedPreferencesUtil.getEchoCancellationTailLength(this);
    mUseNoiseSuppressor = SharedPreferencesUtil.getEchoCancellationUseNoiseSuppressor(this);

    mBroadcastEventSender = new BroadcastEventSender(SipService.this);

    mConfiguredAccounts = SharedPreferencesUtil.loadConfiguredAccounts(this);
    addAllConfiguredAccounts();

    eventReceiver.register(this);

    Log.d(TAG, "SipService started!");
}
 
開發者ID:d0pam1n,項目名稱:DoorPhone,代碼行數:38,代碼來源:SipService.java

示例2: notifyCommand

import android.media.RingtoneManager; //導入方法依賴的package包/類
/**
     * buzzer command notification
     * @param type    buzzer type
     * @return running result
     */
    public boolean notifyCommand(TYPE type) {
        if (ringtone != null) {
            ringtone.stop();
            ringtone = null;
        }

        if (type != TYPE.NONE) {
//            Uri ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(context, type.getLocalType());
//            if (ringtoneUri == null) {
//                return false;
//            }
//            MediaPlayer mediaPlayer = MediaPlayer.create(context, ringtoneUri);
//            mediaPlayer.setLooping(false);
//            mediaPlayer.start();
//            mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
//                @Override
//                public void onCompletion(MediaPlayer mediaPlayer) {
//                    mediaPlayer.release();
//                }
//            });

            Uri ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(context, type.getLocalType());
            if (ringtoneUri == null) {
                return false;
            }

            ringtone = RingtoneManager.getRingtone(context, ringtoneUri);
            ringtone.play();
        }

        return true;
    }
 
開發者ID:SKT-ThingPlug,項目名稱:thingplug-sdk-android,代碼行數:38,代碼來源:Buzzer.java

示例3: updateRingtoneName

import android.media.RingtoneManager; //導入方法依賴的package包/類
private static CharSequence updateRingtoneName(Context context, int type, int subId) {
    if (context == null) {
        Log.e(TAG, "Unable to update ringtone name, no context provided");
        return null;
    }
    Uri ringtoneUri;
    if (type != RingtoneManager.TYPE_RINGTONE || subId <= 0) {
        ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(context, type);
    } else {
        ringtoneUri = RingtoneManager.getActualRingtoneUriBySubId(context, subId);
     }
    CharSequence summary = context.getString(com.android.internal.R.string.ringtone_unknown);
    // Is it a silent ringtone?
    if (ringtoneUri == null) {
        summary = context.getString(com.android.internal.R.string.ringtone_silent);
    } else {
        Cursor cursor = null;
        try {
            if (MediaStore.AUTHORITY.equals(ringtoneUri.getAuthority())) {
                // Fetch the ringtone title from the media provider
                cursor = context.getContentResolver().query(ringtoneUri,
                        new String[] { MediaStore.Audio.Media.TITLE }, null, null, null);
            } else if (ContentResolver.SCHEME_CONTENT.equals(ringtoneUri.getScheme())) {
                cursor = context.getContentResolver().query(ringtoneUri,
                        new String[] { OpenableColumns.DISPLAY_NAME }, null, null, null);
            }
            if (cursor != null) {
                if (cursor.moveToFirst()) {
                    summary = cursor.getString(0);
                }
            }
        } catch (SQLiteException sqle) {
            // Unknown title for the ringtone
        } catch (IllegalArgumentException iae) {
            // Some other error retrieving the column from the provider
        } finally {
            if (cursor != null) {
                cursor.close();
            }
        }
    }
    return summary;
}
 
開發者ID:ric96,項目名稱:lineagex86,代碼行數:44,代碼來源:SoundSettings.java


注:本文中的android.media.RingtoneManager.getActualDefaultRingtoneUri方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。