当前位置: 首页>>代码示例>>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;未经允许,请勿转载。