Android Wifi Connection Create openWifiBrocast()

Here you can find the source of openWifiBrocast()

Description

open Wifi Brocast

Declaration

public static MulticastLock openWifiBrocast() 

Method Source Code

import java.io.InputStream;
import cn.bingoogol.dmc.App;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.NetworkInfo.State;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiManager.MulticastLock;
import android.os.Environment;
import android.widget.Toast;

public class Main{
    public static MulticastLock openWifiBrocast() {
        WifiManager wifiManager = (WifiManager) App.getInstance()
                .getSystemService(Context.WIFI_SERVICE);
        MulticastLock multicastLock = wifiManager
                .createMulticastLock("MediaRender");
        if (multicastLock != null) {
            multicastLock.acquire();/*from   w ww .  jav a 2  s. c om*/
        }
        return multicastLock;
    }
}