List of usage examples for android.net.wifi WifiManager SCAN_RESULTS_AVAILABLE_ACTION
String SCAN_RESULTS_AVAILABLE_ACTION
To view the source code for android.net.wifi WifiManager SCAN_RESULTS_AVAILABLE_ACTION.
Click Source Link
From source file:nl.nielsad.cordova.wifiscanner.WifiListener.java
private Status start() { if ((this.status == Status.RUNNING) || (this.status == Status.STARTING)) { return this.status; }/*ww w .ja v a 2s . c o m*/ this.setStatus(Status.STARTING); if (wifiManager.isWifiEnabled()) { this.cordova.getActivity().registerReceiver(this.wifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); this.wifiManager.startScan(); } else { this.setStatus(Status.ERROR_FAILED_TO_START); this.fail(Status.ERROR_FAILED_TO_START, "Wifi is not enabled"); return this.status; } this.startTimeout(30000); return this.status; }
From source file:org.fitchfamily.android.wifi_backend.backend.BackendService.java
@Override protected void onOpen() { if (DEBUG) {/*from w w w . j av a 2 s . com*/ Log.i(TAG, "onOpen()"); } instance = this; registerReceiver(wifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); if (Configuration.with(this).hasLocationAccess()) { setgpsMonitorRunning(true); } }
From source file:com.geniatech.client_phone.wifi.WifiStatusTest.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mWifiManager = (WifiManager) getSystemService(WIFI_SERVICE); mWifiStateFilter = new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION); mWifiStateFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); mWifiStateFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); mWifiStateFilter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION); mWifiStateFilter.addAction(WifiManager.RSSI_CHANGED_ACTION); mWifiStateFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); registerReceiver(mWifiStateReceiver, mWifiStateFilter); setContentView(R.layout.wifi_status_test); updateButton = (Button) findViewById(R.id.update); updateButton.setOnClickListener(updateButtonHandler); mWifiState = (TextView) findViewById(R.id.wifi_state); mNetworkState = (TextView) findViewById(R.id.network_state); mSupplicantState = (TextView) findViewById(R.id.supplicant_state); mRSSI = (TextView) findViewById(R.id.rssi); mBSSID = (TextView) findViewById(R.id.bssid); mSSID = (TextView) findViewById(R.id.ssid); mHiddenSSID = (TextView) findViewById(R.id.hidden_ssid); mIPAddr = (TextView) findViewById(R.id.ipaddr); mMACAddr = (TextView) findViewById(R.id.macaddr); mNetworkId = (TextView) findViewById(R.id.networkid); mLinkSpeed = (TextView) findViewById(R.id.link_speed); mScanList = (TextView) findViewById(R.id.scan_list); }
From source file:com.hzl.administrator.wifi.WifiStatusTest.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mWifiManager = (WifiManager) getSystemService(WIFI_SERVICE); mWifiStateFilter = new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION); mWifiStateFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); mWifiStateFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); mWifiStateFilter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION); mWifiStateFilter.addAction(WifiManager.RSSI_CHANGED_ACTION); mWifiStateFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); registerReceiver(mWifiStateReceiver, mWifiStateFilter); setContentView(R.layout.wifi_status_test); updateButton = (Button) findViewById(R.id.update); updateButton.setOnClickListener(updateButtonHandler); mWifiState = (TextView) findViewById(R.id.wifi_state); mNetworkState = (TextView) findViewById(R.id.network_state); mSupplicantState = (TextView) findViewById(R.id.supplicant_state); mRSSI = (TextView) findViewById(R.id.rssi); mBSSID = (TextView) findViewById(R.id.bssid); mSSID = (TextView) findViewById(R.id.ssid); mHiddenSSID = (TextView) findViewById(R.id.hidden_ssid); mIPAddr = (TextView) findViewById(R.id.ipaddr); mMACAddr = (TextView) findViewById(R.id.macaddr); mNetworkId = (TextView) findViewById(R.id.networkid); mLinkSpeed = (TextView) findViewById(R.id.link_speed); mScanList = (TextView) findViewById(R.id.scan_list); mPingIpAddr = (TextView) findViewById(R.id.pingIpAddr); mPingHostname = (TextView) findViewById(R.id.pingHostname); mHttpClientTest = (TextView) findViewById(R.id.httpClientTest); pingTestButton = (Button) findViewById(R.id.ping_test); pingTestButton.setOnClickListener(mPingButtonHandler); }
From source file:org.wso2.iot.agent.services.NetworkInfoService.java
@Override public void onCreate() { thisInstance = this; if (Constants.DEBUG_MODE_ENABLED) { Log.d(TAG, "Creating service"); }/*from ww w .j a v a 2 s .c om*/ mapper = new ObjectMapper(); info = getNetworkInfo(); telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); telephonyManager.listen(deviceNetworkStatusListener, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS); wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE); if (Constants.WIFI_SCANNING_ENABLED) { // Register broadcast receiver // Broadcast receiver will automatically call when number of wifi connections changed registerReceiver(wifiScanReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); // start scanning wifi startWifiScan(); } }
From source file:org.eeiiaa.wifi.WifiConnector.java
/** * will create a connector with specified network and specified security if * the password is null or empty seting its the same as constructing without * the password parameter//from ww w .j a va 2 s .co m * * @param ctx * @param ssid * @param pwd */ public WifiConnector(Context ctx, int sro, String ssid, String pwd) { mContext = ctx; mNetssid = ssid; mPwd = pwd; mWifiMgr = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); mMacAddress = mWifiMgr.getConnectionInfo().getMacAddress(); mConnecting = false; mListener = null; mScanListener = null; mDataListener = null; mWaitingConnection = false; mWaitingScan = false; scanResultOption = sro; filter_ = new IntentFilter(); filter_.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); filter_.addAction(ConnectivityManager.CONNECTIVITY_ACTION); }
From source file:org.deviceconnect.android.deviceplugin.hvcc2w.setting.fragment.HVCC2WPairingFragment.java
/** * Check Wifi.//from ww w .j a v a2 s .c om */ private void searchWifi() { final WifiManager wifiManager = getWifiManager(); if (wifiManager.getWifiState() == WifiManager.WIFI_STATE_ENABLED) { mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { List<ScanResult> results = wifiManager.getScanResults(); if (results.size() == 0) { return; } mSSID.setText(results.get(0).SSID); } }; getActivity().registerReceiver(mReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); } wifiManager.startScan(); }
From source file:org.wahtod.wififixer.ui.AboutFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState == null) { /*/*from w w w .j a v a2 s. c o m*/ * Do nothing */ } else { /* * Restore Network */ mNetwork = WFScanResult.fromBundle(savedInstanceState.getBundle(NETWORK_KEY)); } IntentFilter scan = new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); BroadcastHelper.registerReceiver(getActivity(), scanreceiver, scan, false); }
From source file:fr.inria.ucn.collectors.NetworkStateCollector.java
@SuppressLint("NewApi") @Override/* w ww .j ava 2 s.c o m*/ public void onReceive(Context context, Intent intent) { long ts = System.currentTimeMillis(); if (intent.getAction().equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) { context.unregisterReceiver(this); try { JSONArray neighs = new JSONArray(); WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); for (ScanResult r : wm.getScanResults()) { JSONObject o = new JSONObject(); o.put("frequency", r.frequency); o.put("level", r.level); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { o.put("timestamp", r.timestamp); } o.put("bssid", r.BSSID); o.put("ssid", r.SSID); neighs.put(o); } JSONObject wifi = new JSONObject(); wifi.put("list", neighs); Helpers.sendResultObj(context, "wifi_neigh", ts, wifi); } catch (JSONException jex) { Log.w(Constants.LOGTAG, "failed to create json object", jex); } // this will clean the CPU lock too if running on the bg Helpers.releaseWifiLock(); } }
From source file:org.mozilla.mozstumbler.service.stumblerthread.scanners.WifiScanner.java
public void onProxyReceive(Context c, Intent intent) { String action = intent.getAction(); if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(action)) { if (isScanEnabled()) { activatePeriodicScan(ActiveOrPassiveStumbling.ACTIVE_STUMBLING); } else {//w ww .j a va 2 s . c om deactivatePeriodicScan(); } } else if (WifiManager.SCAN_RESULTS_AVAILABLE_ACTION.equals(action)) { final List<ScanResult> scanResultList = wifiManagerProxy.getScanResults(); if (scanResultList == null) { return; } final ArrayList<ScanResult> scanResults = new ArrayList<ScanResult>(); for (ScanResult scanResult : scanResultList) { scanResult.BSSID = BSSIDBlockList.canonicalizeBSSID(scanResult.BSSID); if (shouldLog(scanResult)) { scanResults.add(scanResult); } } mVisibleAPs.set(scanResults.size()); reportScanResults(scanResults); } }