com.google.zxing.client.android.wifi.WifiConfigManager Java Examples

The following examples show how to use com.google.zxing.client.android.wifi.WifiConfigManager. 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: WifiResultHandler.java    From ZXing-Standalone-library with Apache License 2.0 6 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
Example #2
Source File: WifiResultHandler.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 6 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
Example #3
Source File: WifiResultHandler.java    From weex with Apache License 2.0 6 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
Example #4
Source File: WifiResultHandler.java    From Study_Android_Demo with Apache License 2.0 6 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
Example #5
Source File: WifiResultHandler.java    From barcodescanner-lib-aar with MIT License 6 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
Example #6
Source File: WifiResultHandler.java    From reacteu-app with MIT License 5 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    Toast.makeText(getActivity(), fakeR.getId("string", "wifi_changing_network"), Toast.LENGTH_LONG).show();
    taskExec.execute(new WifiConfigManager(wifiManager), wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
Example #7
Source File: WifiResultHandler.java    From android-apps with MIT License 5 votes vote down vote up
@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);
  }
}