0

I want to invoke a BroadcastReceiver on an open WiFi network found, So What should be the Action name in IntentFilter ?

<receiver android:name=".MyWiFiReceiver" >
   <intent-filter>
      <action android:name="?????????????" />
   </intent-filter>
</receiver>
theapache64
  • 10,926
  • 9
  • 65
  • 108

2 Answers2

0

Try this. I used to check connectivity change.

<receiver android:name=".service.NetworkChangeReceiver">
        <intent-filter>
            <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />

            <category android:name="com.example.quangtv" />
        </intent-filter>
</receiver>
Tran Vinh Quang
  • 585
  • 2
  • 9
  • 30
0

I don't think there is such action that will filter the type of network. That said, you can scan the networks upon change and check if their open using method as such:

static int getSecurity(ScanResult result) {

if (result.capabilities.contains("WEP")) {
    return SECURITY_WEP;
} else if (result.capabilities.contains("PSK")) {
    return SECURITY_PSK;
} else if (result.capabilities.contains("EAP")) {
    return SECURITY_EAP;
}
   return SECURITY_NONE;
}

I think this answer might help you (the method above is taken from there): android: Determine security type of wifi networks in range (without connecting to them)

Community
  • 1
  • 1
SuperFrog
  • 7,631
  • 9
  • 51
  • 81
  • But udi, I'm getting a simple notification from the builtin WiFi app when ever a open wifi is found by the device. so i think there's some specific action correspond to the event. Anyways thanks for the answer :) – theapache64 Nov 11 '15 at 02:41
  • Well, you can achieve that by checking the networks this way after you've been notified by android.net.conn.CONNECTIVITY_CHANGE – SuperFrog Nov 11 '15 at 11:25