Code example for AudioManager

Methods: setRingerModesetStreamVolumesetVibrateSetting

0
				//Log.i(TAG, "[��������]��ǰ�������ֲ���"); 
				volume = mAudioManager.getStreamVolume(AudioManager.STREAM_RING);
			} 
			else if (vibrator == 0) {  //���𶯱��ֲ���
				//Log.i(TAG, "[��������]��ǰ�񶯱��ֲ���"); 
				mAudioManager.setStreamVolume(AudioManager.STREAM_RING, volume, 0);
				mAudioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, volume, 0);
			} 
			//Log.i(TAG, "[��������]��ʼ����===>����������" + mAudioManager.getStreamVolume(AudioManager.STREAM_RING) + "���񶯣�" + mAudioManager.getStreamVolume(AudioManager.VIBRATE_SETTING_ON) + "����ģʽ��" + mAudioManager.getRingerMode()); 
			//Log.i(TAG, "[��������]���ò���===>����������" + volume + "���񶯣�" + vibrator); 
			if (volume == 0){  //����ģʽ
				//mAudioManager.setVibrateSetting(AudioManager.VIBRATE_SETTING_ON, vibrateSetting); 
				if (vibrator == 1) {
					mAudioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);  //1 - ������������
					mAudioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);  //��������
				} 
				else if (vibrator == 2) {
					mAudioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);  //0 - ������������
					mAudioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);  //�ر�����
				} 
			} 
			else { 
				mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);  //2 - �����������񶯿�����setVibrateSetting����.
				if (vibrator == 1) {
					mAudioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);  //��������
		        } else if (vibrator == 2) {
		        	mAudioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);  //�ر�����
		        } 
				mAudioManager.setStreamVolume(AudioManager.STREAM_RING, volume, 0);
				mAudioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, volume, 0);
			} 
			 
			//Log.i(TAG, "[��������]��������==>����������" + mAudioManager.getStreamVolume(AudioManager.STREAM_RING) + "����ģʽ��" + mAudioManager.getRingerMode()); 
		} 
		catch (Exception ex) {