Code example for AudioManager

Methods: getProperty

0
	 
	@TargetApi(17) 
	private void detectOptimalAudioSettings() { 
		AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE); 
		try { 
			optimalFramesPerBuffer = Integer.parseInt(am.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER));		 
			optimalSampleRate = Integer.parseInt(am.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE)); 
		} catch (NumberFormatException e) { 
			// Ignore, if we can't parse it it's bogus and zero is a fine value (means we couldn't detect it). 
		} 
	} 
	 
	String getApplicationLibraryDir(ApplicationInfo application) {     
	    String libdir = null; 
	    try { 
	        // Starting from Android 2.3, nativeLibraryDir is available: 
	        Field field = ApplicationInfo.class.getField("nativeLibraryDir"); 
	        libdir = (String) field.get(application); 
	    } catch (SecurityException e1) { 
	    } catch (NoSuchFieldException e1) { 
	    } catch (IllegalArgumentException e) {