Java Code Examples for android.net.wifi.WifiManager#NETWORK_STATE_CHANGED_ACTION

The following examples show how to use android.net.wifi.WifiManager#NETWORK_STATE_CHANGED_ACTION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WifiDrawer.java    From meter with Apache License 2.0 6 votes vote down vote up
public WifiDrawer(Context context){
    super(
            context,
            context.getResources().getColor(R.color.wifi_background),
            context.getResources().getColor(R.color.wifi_triangle_background),
            context.getResources().getColor(R.color.wifi_triangle_foreground),
            context.getResources().getColor(R.color.wifi_triangle_critical)
    );

    this.label1 = "WIFI";

    // Register for Wifi state change notifications
    IntentFilter ifilter = new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION);
    ifilter.addAction(WifiManager.RSSI_CHANGED_ACTION);
    context.registerReceiver(wifiReceiver, ifilter);
}
 
Example 2
Source File: RxWifiManager.java    From rx-receivers with Apache License 2.0 6 votes vote down vote up
/** TODO: docs. */
@CheckResult @NonNull //
public static Observable<NetworkStateChangedEvent> //
networkStateChanges(@NonNull final Context context) {
  checkNotNull(context, "context == null");
  IntentFilter filter = new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION);
  return RxBroadcastReceiver.create(context, filter)
      .map(new Func1<Intent, NetworkStateChangedEvent>() {
        @Override public NetworkStateChangedEvent call(Intent intent) {
          NetworkInfo networkInfo = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
          String bssid = intent.getStringExtra(WifiManager.EXTRA_BSSID);
          WifiInfo wifiInfo = intent.getParcelableExtra(WifiManager.EXTRA_WIFI_INFO);
          return NetworkStateChangedEvent.create(networkInfo, bssid, wifiInfo);
        }
      });
}
 
Example 3
Source File: PopupMenuDialog.java    From FileTransfer with GNU General Public License v3.0 4 votes vote down vote up
void registerWifiConnectChangedReceiver() {
    IntentFilter intentFilter = new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION);
    context.registerReceiver(mWifiConnectChangedReceiver, intentFilter);
}
 
Example 4
Source File: WifiIconData.java    From Status with Apache License 2.0 4 votes vote down vote up
@Override
public IntentFilter getIntentFilter() {
    return new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION);
}
 
Example 5
Source File: NetworkStateMonitor.java    From LibreTasks with Apache License 2.0 4 votes vote down vote up
public void init() {
  TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
  tm.listen(phoneStateListener, PhoneStateListener.LISTEN_DATA_CONNECTION_STATE);
  IntentFilter intentFilter = new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION);
  context.registerReceiver(this, intentFilter);
}