Code example for WifiManager.MulticastLock

Methods: acquire

0
	 
	public static boolean openWifiBrocast(Context context){
		WifiManager wifiManager=(WifiManager)context.getSystemService(Context.WIFI_SERVICE);
		MulticastLock  multicastLock=wifiManager.createMulticastLock("MediaPlayer");
		if (multicastLock != null){
			multicastLock.acquire();
			return true; 
		} 
		return false; 
	} 
	 
	 
	public static void setCurrentVolume(int percent,Context mc){
		AudioManager am=(AudioManager)mc.getSystemService(Context.AUDIO_SERVICE);
		int maxvolume=am.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
		am.setStreamVolume(AudioManager.STREAM_MUSIC, (maxvolume*percent)/100, 
				AudioManager.FLAG_PLAY_SOUND|AudioManager.FLAG_SHOW_UI);
		am.setMode(AudioManager.MODE_INVALID);
	} 
	 
	public static void setVolumeMute(Context mc){