当前位置: 首页>>代码示例>>Java>>正文


Java RingtoneManager.getRingtoneUri方法代码示例

本文整理汇总了Java中android.media.RingtoneManager.getRingtoneUri方法的典型用法代码示例。如果您正苦于以下问题:Java RingtoneManager.getRingtoneUri方法的具体用法?Java RingtoneManager.getRingtoneUri怎么用?Java RingtoneManager.getRingtoneUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.media.RingtoneManager的用法示例。


在下文中一共展示了RingtoneManager.getRingtoneUri方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNotifications

import android.media.RingtoneManager; //导入方法依赖的package包/类
public Map<String, String> getNotifications() {
    RingtoneManager manager = new RingtoneManager(getActivity());
    manager.setType(RingtoneManager.TYPE_NOTIFICATION);
    Cursor cursor = manager.getCursor();
    Map<String, String> list = new HashMap<>();
    while (cursor.moveToNext()) {
        String notificationTitle = cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX);
        Uri notificationUri = manager.getRingtoneUri(cursor.getPosition());
        list.put(notificationTitle, notificationUri.toString());
    }

    list.put(getString(R.string.ringtone_vk), Settings.get()
            .notifications()
            .getDefNotificationRingtone());
    return list;
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:17,代码来源:NotificationPreferencesFragment.java

示例2: searchAlarmUri

import android.media.RingtoneManager; //导入方法依赖的package包/类
private Uri searchAlarmUri(int alarmId) {
    Context context = MBApp.getApp();

    RingtoneManager ringtoneMgr = new RingtoneManager(context);
    ringtoneMgr.setType(RingtoneManager.TYPE_ALARM);
    Cursor alarms = ringtoneMgr.getCursor();
    Log.i(TAG, "playAlarm: total alarms = " + alarms.getCount());

    alarms.moveToPosition(alarmId - 4);
    Uri alarm = ringtoneMgr.getRingtoneUri(alarms.getPosition());

    if(alarm == null) {
        Log.i(TAG, "Cannot play nth Alarm. Playing default");
        alarm = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
    }

    return alarm;
}
 
开发者ID:Samsung,项目名称:microbit,代码行数:19,代码来源:AlertPlugin.java

示例3: startPlayingRing

import android.media.RingtoneManager; //导入方法依赖的package包/类
private void startPlayingRing() {
    RingtoneManager ringtoneManager = new RingtoneManager(this);
    ringtoneManager.setType(RingtoneManager.TYPE_ALARM);
    ringtoneManager.getCursor();

    Uri ringtoneUri = ringtoneManager.getRingtoneUri(alarm.ringPosition);
    AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
    audioManager.setStreamVolume(AudioManager.STREAM_ALARM, 7, AudioManager.ADJUST_SAME);
    mediaPlayer = new MediaPlayer();
    try {
        mediaPlayer.setDataSource(this, ringtoneUri);
        mediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
        mediaPlayer.prepare();
        mediaPlayer.start();
        mediaPlayer.setLooping(true);

    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:segasunset,项目名称:WeatherAlarmClock,代码行数:21,代码来源:BootAlarmActivity.java


注:本文中的android.media.RingtoneManager.getRingtoneUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。