Java Code Examples for com.google.zxing.client.result.WifiParsedResult#getNetworkEncryption()
The following examples show how to use
com.google.zxing.client.result.WifiParsedResult#getNetworkEncryption() .
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: WifiResultFragment.java From privacy-friendly-qr-scanner with GNU General Public License v3.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View v = inflater.inflate(R.layout.fragment_result_wifi, container, false); result = (WifiParsedResult) parsedResult; ssid = result.getSsid(); String encryption = result.getNetworkEncryption(); pw = result.getPassword(); TextView resultField = (TextView) v.findViewById(R.id.result_field_wifi); TextView resultFieldEncryption = (TextView) v.findViewById(R.id.result_field_wifi_encryption); TextView resultFieldPassword = (TextView) v.findViewById(R.id.result_field_wifi_pw); resultField.setText("SSID: " + ssid); resultFieldEncryption.setText(getString(R.string.encryption) + ": " + encryption); resultFieldPassword.setText("PW: " + pw); return v; }
Example 2
Source File: WifiResultHandler.java From android-apps with MIT License | 5 votes |
@Override public void handleButtonPress(int index) { // Get the underlying wifi config WifiParsedResult wifiResult = (WifiParsedResult) getResult(); if (index == 0) { String ssid = wifiResult.getSsid(); String password = wifiResult.getPassword(); String networkType = wifiResult.getNetworkEncryption(); WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE); Toast.makeText(getActivity(), R.string.wifi_changing_network, Toast.LENGTH_LONG).show(); WifiConfigManager.configure(wifiManager, ssid, password, networkType); parent.restartPreviewAfterDelay(0L); } }
Example 3
Source File: WifiConfigManager.java From ZXing-Standalone-library with Apache License 2.0 | 4 votes |
@Override protected Object doInBackground(WifiParsedResult... args) { WifiParsedResult theWifiResult = args[0]; // Start WiFi, otherwise nothing will work if (!wifiManager.isWifiEnabled()) { Log.i(TAG, "Enabling wi-fi..."); if (wifiManager.setWifiEnabled(true)) { Log.i(TAG, "Wi-fi enabled"); } else { Log.w(TAG, "Wi-fi could not be enabled!"); return null; } // This happens very quickly, but need to wait for it to enable. A little busy wait? int count = 0; while (!wifiManager.isWifiEnabled()) { if (count >= 10) { Log.i(TAG, "Took too long to enable wi-fi, quitting"); return null; } Log.i(TAG, "Still waiting for wi-fi to enable..."); try { Thread.sleep(1000L); } catch (InterruptedException ie) { // continue } count++; } } String networkTypeString = theWifiResult.getNetworkEncryption(); NetworkType networkType; try { networkType = NetworkType.forIntentValue(networkTypeString); } catch (IllegalArgumentException ignored) { Log.w(TAG, "Bad network type; see NetworkType values: " + networkTypeString); return null; } if (networkType == NetworkType.NO_PASSWORD) { changeNetworkUnEncrypted(wifiManager, theWifiResult); } else { String password = theWifiResult.getPassword(); if (password != null && !password.isEmpty()) { if (networkType == NetworkType.WEP) { changeNetworkWEP(wifiManager, theWifiResult); } else if (networkType == NetworkType.WPA) { changeNetworkWPA(wifiManager, theWifiResult); } } } return null; }
Example 4
Source File: WifiResultHandler.java From ZXing-Standalone-library with Apache License 2.0 | 4 votes |
@Override public CharSequence getDisplayContents() { WifiParsedResult wifiResult = (WifiParsedResult) getResult(); return wifiResult.getSsid() + " (" + wifiResult.getNetworkEncryption() + ')'; }
Example 5
Source File: WifiConfigManager.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 4 votes |
@Override protected Object doInBackground(WifiParsedResult... args) { WifiParsedResult theWifiResult = args[0]; // Start WiFi, otherwise nothing will work if (!wifiManager.isWifiEnabled()) { Log.i(TAG, "Enabling wi-fi..."); if (wifiManager.setWifiEnabled(true)) { Log.i(TAG, "Wi-fi enabled"); } else { Log.w(TAG, "Wi-fi could not be enabled!"); return null; } // This happens very quickly, but need to wait for it to enable. A little busy wait? int count = 0; while (!wifiManager.isWifiEnabled()) { if (count >= 10) { Log.i(TAG, "Took too long to enable wi-fi, quitting"); return null; } Log.i(TAG, "Still waiting for wi-fi to enable..."); try { Thread.sleep(1000L); } catch (InterruptedException ie) { // continue } count++; } } String networkTypeString = theWifiResult.getNetworkEncryption(); NetworkType networkType; try { networkType = NetworkType.forIntentValue(networkTypeString); } catch (IllegalArgumentException ignored) { Log.w(TAG, "Bad network type; see NetworkType values: " + networkTypeString); return null; } if (networkType == NetworkType.NO_PASSWORD) { changeNetworkUnEncrypted(wifiManager, theWifiResult); } else { String password = theWifiResult.getPassword(); if (password != null && !password.isEmpty()) { if (networkType == NetworkType.WEP) { changeNetworkWEP(wifiManager, theWifiResult); } else if (networkType == NetworkType.WPA) { changeNetworkWPA(wifiManager, theWifiResult); } } } return null; }
Example 6
Source File: WifiResultHandler.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 4 votes |
@Override public CharSequence getDisplayContents() { WifiParsedResult wifiResult = (WifiParsedResult) getResult(); return wifiResult.getSsid() + " (" + wifiResult.getNetworkEncryption() + ')'; }
Example 7
Source File: WifiConfigManager.java From weex with Apache License 2.0 | 4 votes |
@Override protected Object doInBackground(WifiParsedResult... args) { WifiParsedResult theWifiResult = args[0]; // Start WiFi, otherwise nothing will work if (!wifiManager.isWifiEnabled()) { Log.i(TAG, "Enabling wi-fi..."); if (wifiManager.setWifiEnabled(true)) { Log.i(TAG, "Wi-fi enabled"); } else { Log.w(TAG, "Wi-fi could not be enabled!"); return null; } // This happens very quickly, but need to wait for it to enable. A little busy wait? int count = 0; while (!wifiManager.isWifiEnabled()) { if (count >= 10) { Log.i(TAG, "Took too long to enable wi-fi, quitting"); return null; } Log.i(TAG, "Still waiting for wi-fi to enable..."); try { Thread.sleep(1000L); } catch (InterruptedException ie) { // continue } count++; } } String networkTypeString = theWifiResult.getNetworkEncryption(); NetworkType networkType; try { networkType = NetworkType.forIntentValue(networkTypeString); } catch (IllegalArgumentException ignored) { Log.w(TAG, "Bad network type; see NetworkType values: " + networkTypeString); return null; } if (networkType == NetworkType.NO_PASSWORD) { changeNetworkUnEncrypted(wifiManager, theWifiResult); } else { String password = theWifiResult.getPassword(); if (password != null && !password.isEmpty()) { if (networkType == NetworkType.WEP) { changeNetworkWEP(wifiManager, theWifiResult); } else if (networkType == NetworkType.WPA) { changeNetworkWPA(wifiManager, theWifiResult); } } } return null; }
Example 8
Source File: WifiResultHandler.java From weex with Apache License 2.0 | 4 votes |
@Override public CharSequence getDisplayContents() { WifiParsedResult wifiResult = (WifiParsedResult) getResult(); return wifiResult.getSsid() + " (" + wifiResult.getNetworkEncryption() + ')'; }
Example 9
Source File: WifiConfigManager.java From Study_Android_Demo with Apache License 2.0 | 4 votes |
@Override protected Object doInBackground(WifiParsedResult... args) { WifiParsedResult theWifiResult = args[0]; // Start WiFi, otherwise nothing will work if (!wifiManager.isWifiEnabled()) { Log.i(TAG, "Enabling wi-fi..."); if (wifiManager.setWifiEnabled(true)) { Log.i(TAG, "Wi-fi enabled"); } else { Log.w(TAG, "Wi-fi could not be enabled!"); return null; } // This happens very quickly, but need to wait for it to enable. A little busy wait? int count = 0; while (!wifiManager.isWifiEnabled()) { if (count >= 10) { Log.i(TAG, "Took too long to enable wi-fi, quitting"); return null; } Log.i(TAG, "Still waiting for wi-fi to enable..."); try { Thread.sleep(1000L); } catch (InterruptedException ie) { // continue } count++; } } String networkTypeString = theWifiResult.getNetworkEncryption(); NetworkType networkType; try { networkType = NetworkType.forIntentValue(networkTypeString); } catch (IllegalArgumentException ignored) { Log.w(TAG, "Bad network type; see NetworkType values: " + networkTypeString); return null; } if (networkType == NetworkType.NO_PASSWORD) { changeNetworkUnEncrypted(wifiManager, theWifiResult); } else { String password = theWifiResult.getPassword(); if (password != null && !password.isEmpty()) { if (networkType == NetworkType.WEP) { changeNetworkWEP(wifiManager, theWifiResult); } else if (networkType == NetworkType.WPA) { changeNetworkWPA(wifiManager, theWifiResult); } } } return null; }
Example 10
Source File: WifiResultHandler.java From Study_Android_Demo with Apache License 2.0 | 4 votes |
@Override public CharSequence getDisplayContents() { WifiParsedResult wifiResult = (WifiParsedResult) getResult(); return wifiResult.getSsid() + " (" + wifiResult.getNetworkEncryption() + ')'; }
Example 11
Source File: WifiConfigManager.java From barcodescanner-lib-aar with MIT License | 4 votes |
@Override protected Object doInBackground(WifiParsedResult... args) { WifiParsedResult theWifiResult = args[0]; // Start WiFi, otherwise nothing will work if (!wifiManager.isWifiEnabled()) { Log.i(TAG, "Enabling wi-fi..."); if (wifiManager.setWifiEnabled(true)) { Log.i(TAG, "Wi-fi enabled"); } else { Log.w(TAG, "Wi-fi could not be enabled!"); return null; } // This happens very quickly, but need to wait for it to enable. A little busy wait? int count = 0; while (!wifiManager.isWifiEnabled()) { if (count >= 10) { Log.i(TAG, "Took too long to enable wi-fi, quitting"); return null; } Log.i(TAG, "Still waiting for wi-fi to enable..."); try { Thread.sleep(1000L); } catch (InterruptedException ie) { // continue } count++; } } String networkTypeString = theWifiResult.getNetworkEncryption(); NetworkType networkType; try { networkType = NetworkType.forIntentValue(networkTypeString); } catch (IllegalArgumentException ignored) { Log.w(TAG, "Bad network type; see NetworkType values: " + networkTypeString); return null; } if (networkType == NetworkType.NO_PASSWORD) { changeNetworkUnEncrypted(wifiManager, theWifiResult); } else { String password = theWifiResult.getPassword(); if (password != null && !password.isEmpty()) { if (networkType == NetworkType.WEP) { changeNetworkWEP(wifiManager, theWifiResult); } else if (networkType == NetworkType.WPA) { changeNetworkWPA(wifiManager, theWifiResult); } } } return null; }
Example 12
Source File: WifiResultHandler.java From barcodescanner-lib-aar with MIT License | 4 votes |
@Override public CharSequence getDisplayContents() { WifiParsedResult wifiResult = (WifiParsedResult) getResult(); return wifiResult.getSsid() + " (" + wifiResult.getNetworkEncryption() + ')'; }
Example 13
Source File: WifiConfigManager.java From reacteu-app with MIT License | 4 votes |
@Override protected Object doInBackground(WifiParsedResult... args) { WifiParsedResult theWifiResult = args[0]; // Start WiFi, otherwise nothing will work if (!wifiManager.isWifiEnabled()) { Log.i(TAG, "Enabling wi-fi..."); if (wifiManager.setWifiEnabled(true)) { Log.i(TAG, "Wi-fi enabled"); } else { Log.w(TAG, "Wi-fi could not be enabled!"); return null; } // This happens very quickly, but need to wait for it to enable. A little busy wait? int count = 0; while (!wifiManager.isWifiEnabled()) { if (count >= 10) { Log.i(TAG, "Took too long to enable wi-fi, quitting"); return null; } Log.i(TAG, "Still waiting for wi-fi to enable..."); try { Thread.sleep(1000L); } catch (InterruptedException ie) { // continue } count++; } } String networkTypeString = theWifiResult.getNetworkEncryption(); NetworkType networkType; try { networkType = NetworkType.forIntentValue(networkTypeString); } catch (IllegalArgumentException iae) { Log.w(TAG, "Bad network type; see NetworkType values: " + networkTypeString); return null; } if (networkType == NetworkType.NO_PASSWORD) { changeNetworkUnEncrypted(wifiManager, theWifiResult); } else { String password = theWifiResult.getPassword(); if (password != null && password.length() != 0) { if (networkType == NetworkType.WEP) { changeNetworkWEP(wifiManager, theWifiResult); } else if (networkType == NetworkType.WPA) { changeNetworkWPA(wifiManager, theWifiResult); } } } return null; }
Example 14
Source File: WifiConfigManager.java From zxingfragmentlib with Apache License 2.0 | 4 votes |
@Override protected Object doInBackground(WifiParsedResult... args) { WifiParsedResult theWifiResult = args[0]; // Start WiFi, otherwise nothing will work if (!wifiManager.isWifiEnabled()) { Log.i(TAG, "Enabling wi-fi..."); if (wifiManager.setWifiEnabled(true)) { Log.i(TAG, "Wi-fi enabled"); } else { Log.w(TAG, "Wi-fi could not be enabled!"); return null; } // This happens very quickly, but need to wait for it to enable. A little busy wait? int count = 0; while (!wifiManager.isWifiEnabled()) { if (count >= 10) { Log.i(TAG, "Took too long to enable wi-fi, quitting"); return null; } Log.i(TAG, "Still waiting for wi-fi to enable..."); try { Thread.sleep(1000L); } catch (InterruptedException ie) { // continue } count++; } } String networkTypeString = theWifiResult.getNetworkEncryption(); NetworkType networkType; try { networkType = NetworkType.forIntentValue(networkTypeString); } catch (IllegalArgumentException ignored) { Log.w(TAG, "Bad network type; see NetworkType values: " + networkTypeString); return null; } if (networkType == NetworkType.NO_PASSWORD) { changeNetworkUnEncrypted(wifiManager, theWifiResult); } else { String password = theWifiResult.getPassword(); if (password != null && !password.isEmpty()) { if (networkType == NetworkType.WEP) { changeNetworkWEP(wifiManager, theWifiResult); } else if (networkType == NetworkType.WPA) { changeNetworkWPA(wifiManager, theWifiResult); } } } return null; }
Example 15
Source File: WifiConfigManager.java From BarcodeEye with Apache License 2.0 | 4 votes |
@Override protected Object doInBackground(WifiParsedResult... args) { WifiParsedResult theWifiResult = args[0]; // Start WiFi, otherwise nothing will work if (!wifiManager.isWifiEnabled()) { Log.i(TAG, "Enabling wi-fi..."); if (wifiManager.setWifiEnabled(true)) { Log.i(TAG, "Wi-fi enabled"); } else { Log.w(TAG, "Wi-fi could not be enabled!"); return null; } // This happens very quickly, but need to wait for it to enable. A little busy wait? int count = 0; while (!wifiManager.isWifiEnabled()) { if (count >= 10) { Log.i(TAG, "Took too long to enable wi-fi, quitting"); return null; } Log.i(TAG, "Still waiting for wi-fi to enable..."); try { Thread.sleep(1000L); } catch (InterruptedException ie) { // continue } count++; } } String networkTypeString = theWifiResult.getNetworkEncryption(); NetworkType networkType; try { networkType = NetworkType.forIntentValue(networkTypeString); } catch (IllegalArgumentException ignored) { Log.w(TAG, "Bad network type; see NetworkType values: " + networkTypeString); return null; } if (networkType == NetworkType.NO_PASSWORD) { changeNetworkUnEncrypted(wifiManager, theWifiResult); } else { String password = theWifiResult.getPassword(); if (password != null && !password.isEmpty()) { if (networkType == NetworkType.WEP) { changeNetworkWEP(wifiManager, theWifiResult); } else if (networkType == NetworkType.WPA) { changeNetworkWPA(wifiManager, theWifiResult); } } } return null; }