监听WIFI
protected void t1() {
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
System.out.println("-----------------------------------3---------------");
System.out.println(intent.getAction());
if (WifiManager.NETWORK_STATE_CHANGED_ACTION.equals(action)) {
wifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
if (wifiManager.isWifiEnabled()) {
Get_IP();
To_Notification_Wifi();
}
}
}
};
IntentFilter intentFilter = new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION);
registerReceiver(broadcastReceiver, intentFilter);
}