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


Java AudioManager.RINGER_MODE_NORMAL属性代码示例

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


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

示例1: shouldBeep

private static boolean shouldBeep(SharedPreferences prefs, Context activity) {
	boolean shouldPlayBeep = true;
	if (shouldPlayBeep) {
		// See if sound settings overrides this
		AudioManager audioService = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
		if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
			shouldPlayBeep = false;
		}
	}
	return shouldPlayBeep;
}
 
开发者ID:wp521,项目名称:MyFire,代码行数:11,代码来源:BeepManager.java

示例2: startMusic

public void startMusic(int type, int startTime) {
	/* Check if Music is allowed to start */
	requestFocus();
	if(noFocus)
		return;
	if(isInactive)
		return;
	
	if(isMusicReady) {
		/* NOP */
	} else {
		loadMusic(type,startTime);
	}
	if(isMusicReady) {
		if(audioCEO.getRingerMode() != AudioManager.RINGER_MODE_NORMAL)
			return;
		
		musicPlayer.setVolume(0.01f * PreferenceManager.getDefaultSharedPreferences(host).getInt("pref_musicvolume", 60), 0.01f * PreferenceManager.getDefaultSharedPreferences(host).getInt("pref_musicvolume", 60));
		musicPlayer.start();
	}
}
 
开发者ID:StringMon,项目名称:homescreenarcade,代码行数:21,代码来源:Sound.java

示例3: buttonSound

public void buttonSound() {
	if(noFocus)
		return;
	if(audioCEO.getRingerMode() != AudioManager.RINGER_MODE_NORMAL)
		return;
	if(!PreferenceManager.getDefaultSharedPreferences(host).getBoolean("pref_button_sound", true))
		return;
	soundPool.play(
		soundID_buttonSoundPlayer,
		0.01f * PreferenceManager.getDefaultSharedPreferences(host).getInt("pref_soundvolume", 60), 
		0.01f * PreferenceManager.getDefaultSharedPreferences(host).getInt("pref_soundvolume", 60), 
		1, 
		0, 
		1.0f
	);
}
 
开发者ID:StringMon,项目名称:homescreenarcade,代码行数:16,代码来源:Sound.java

示例4: onResume

@Override
protected void onResume() {
	super.onResume();
	SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
	SurfaceHolder surfaceHolder = surfaceView.getHolder();
	if (hasSurface) {
		initCamera(surfaceHolder);
	} else {
		surfaceHolder.addCallback(this);
		surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
	}
	decodeFormats = null;
	characterSet = null;

	playBeep = true;
	AudioManager audioService = (AudioManager) getSystemService(AUDIO_SERVICE);
	if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
		playBeep = false;
	}
	initBeepSound();
	vibrate = true;
	
}
 
开发者ID:CoderCF,项目名称:ZXingDemo,代码行数:23,代码来源:CaptureActivity.java

示例5: StartCameraScanner

public  void StartCameraScanner() {
    inactivityTimer = new InactivityTimer(this.getActivity());
    if (!hasSurface) {
        initCamera(surfaceHolder);
    } else {
        surfaceHolder.addCallback(this);
        surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    }
    decodeFormats = null;
    characterSet = null;
    playBeep = true;
    AudioManager audioService = (AudioManager) getActivity().getSystemService(getActivity().AUDIO_SERVICE);
    if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
        playBeep = false;
    }
    initBeepSound();
    vibrate = true;
}
 
开发者ID:RuanXiaoHui,项目名称:ZxingScan,代码行数:18,代码来源:CaptureFragment.java

示例6: onResume

@Override
protected void onResume() {
	super.onResume();
	SurfaceHolder surfaceHolder = surfaceView.getHolder();
	if (hasSurface) {
		initCamera(surfaceHolder);
	} else {
		surfaceHolder.addCallback(this);
		surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
	}
	decodeFormats = null;
	characterSet = null;

	playBeep = true;
	AudioManager audioService = (AudioManager) getSystemService(AUDIO_SERVICE);
	if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
		playBeep = false;
	}
	initBeepSound();
	vibrate = true;
}
 
开发者ID:TommyLemon,项目名称:APIJSON-Android-RxJava,代码行数:21,代码来源:CaptureActivity.java

示例7: shouldBeep

private static boolean shouldBeep(SharedPreferences prefs, Context activity) {
    boolean shouldPlayBeep = prefs.getBoolean(PreferencesActivity.KEY_PLAY_BEEP, true);
    if (shouldPlayBeep) {
        // See if sound settings overrides this
        AudioManager audioService = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
        if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
            shouldPlayBeep = false;
        }
    }
    return shouldPlayBeep;
}
 
开发者ID:xiong-it,项目名称:ZXingAndroidExt,代码行数:11,代码来源:BeepManager.java

示例8: shouldBeep

private static boolean shouldBeep(SharedPreferences prefs, Context activity) {
    boolean shouldPlayBeep = true;
    if (shouldPlayBeep) {
        // See if sound settings overrides this
        AudioManager audioService = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
        if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
            shouldPlayBeep = false;
        }
    }
    return shouldPlayBeep;
}
 
开发者ID:WindFromFarEast,项目名称:SmartButler,代码行数:11,代码来源:BeepManager.java

示例9: shouldBeep

private static boolean shouldBeep(SharedPreferences prefs, Context activity) {
    boolean shouldPlayBeep = prefs.getBoolean(activity.getString(R.string.preferences_play_beep), true);
    if (shouldPlayBeep) {
        // See if sound settings overrides this
        AudioManager audioService = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
        if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
            shouldPlayBeep = false;
        }
    }
    return shouldPlayBeep;
}
 
开发者ID:guzhigang001,项目名称:Zxing,代码行数:11,代码来源:BeepManager.java

示例10: start

public void start() {
  AudioManager audioManager = ServiceUtil.getAudioManager(context);

  if (player != null) player.release();
  player = createPlayer();

  int ringerMode = audioManager.getRingerMode();

  if (shouldVibrate(context, player, ringerMode)) {
    Log.i(TAG, "Starting vibration");
    vibrator.vibrate(VIBRATE_PATTERN, 1);
  }

  if (player != null && ringerMode == AudioManager.RINGER_MODE_NORMAL) {
    try {
      if (!player.isPlaying()) {
        player.prepare();
        player.start();
        Log.w(TAG, "Playing ringtone now...");
      } else {
        Log.w(TAG, "Ringtone is already playing, declining to restart.");
      }
    } catch (IllegalStateException | IOException e) {
      Log.w(TAG, e);
      player = null;
    }
  } else {
    Log.w(TAG, "Not ringing, mode: " + ringerMode);
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:30,代码来源:IncomingRinger.java

示例11: shouldBeep

private static boolean shouldBeep(SharedPreferences prefs, Context activity) {
  boolean shouldPlayBeep = true;//prefs.getBoolean(PreferencesActivity.KEY_PLAY_BEEP, true);
  if (shouldPlayBeep) {
    // See if sound settings overrides this
    AudioManager audioService = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
    if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
      shouldPlayBeep = false;
    }
  }
  return shouldPlayBeep;
}
 
开发者ID:crisfg86,项目名称:Zxing-Custom,代码行数:11,代码来源:BeepManager.java

示例12: playAudio

/**
 * 播放音效
 * 
 * @param pSoundName
 */
public void playAudio(String pSoundName)
{
	if (mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL)
	{
		// 在响铃模式为Normal的情况下播放音频
		// 音频对应id,左右声道大小,优先级,循环次数,播放速率:1代表正常播放:范围:0.5-2
		mSoundPool.play(mSoundPoolMap.get(pSoundName).intValue(), 1, 1, 0, 0, 1);
	}
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:14,代码来源:SoundPoolUtils.java

示例13: shouldBeep

private static boolean shouldBeep(SharedPreferences prefs, Context activity) {
  boolean shouldPlayBeep = prefs.getBoolean(PreferencesActivity.KEY_PLAY_BEEP, true);
  if (shouldPlayBeep) {
    // See if sound settings overrides this
    AudioManager audioService = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
    if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
      shouldPlayBeep = false;
    }
  }
  return shouldPlayBeep;
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:11,代码来源:BeepManager.java

示例14: onItemClick

public void onItemClick(AdapterView<?> arg0, View arg1, int index, long arg3) {
	
	AudioManager manager = (AudioManager) mActivity.getSystemService(Context.AUDIO_SERVICE);
	if (manager != null) {

		int ringerMode = AudioManager.RINGER_MODE_NORMAL;
		int vibroMode = AudioManager.VIBRATE_SETTING_ON;
		
		switch(index) {
			case 0: // silent
				ringerMode = AudioManager.RINGER_MODE_SILENT;
				vibroMode = AudioManager.VIBRATE_SETTING_ONLY_SILENT;
				break;
			case 1: // vibro
				ringerMode = AudioManager.RINGER_MODE_VIBRATE;
				vibroMode = AudioManager.VIBRATE_SETTING_ON;
				break;
			case 2: // sound
				ringerMode = AudioManager.RINGER_MODE_NORMAL;
				vibroMode = AudioManager.VIBRATE_SETTING_OFF;
				break;
			case 3: // sound and vibro
				ringerMode = AudioManager.RINGER_MODE_NORMAL;
				vibroMode = AudioManager.VIBRATE_SETTING_ON;
				break;
		}
		
		// update manager modes
		
		// update
		manager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, vibroMode);
		manager.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, vibroMode);
		manager.setRingerMode(ringerMode);
		
		validateState(manager);
	}
	
	mDialog.hide();
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:39,代码来源:RingerSettingHandler.java

示例15: playRingtone

public void playRingtone() {
    AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);

    // Honour silent mode
    switch (audioManager.getRingerMode()) {
        case AudioManager.RINGER_MODE_NORMAL:
            mPlayer = new MediaPlayer();
            mPlayer.setAudioStreamType(AudioManager.STREAM_RING);

            try {
                if(hasSIM())
                    mPlayer.setDataSource(mContext, RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE));
                else
                    mPlayer.setDataSource(mContext, RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM));
                mPlayer.prepare();
            } catch (IOException e) {
                Log.e(LOG_TAG, "Could not setup media player for ringtone");
                mPlayer = null;
                return;
            }
            mPlayer.setLooping(true);
            mPlayer.start();
            break;
        case AudioManager.RINGER_MODE_VIBRATE:
            mVibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
            if(mVibrator.hasVibrator()) {
                long[] pattern = {0, 500, 200};

                // The '0' here means to repeat indefinitely
                // '0' is actually the index at which the pattern keeps repeating from (the start)
                // To repeat the pattern from any other point, you could increase the index, e.g. '1'
                mVibrator.vibrate(pattern, 0);
            }
            break;
    }
}
 
开发者ID:squareboat,项目名称:Excuser,代码行数:36,代码来源:AudioPlayer.java


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