Example usage for android.provider Settings ACTION_WIFI_SETTINGS

List of usage examples for android.provider Settings ACTION_WIFI_SETTINGS

Introduction

In this page you can find the example usage for android.provider Settings ACTION_WIFI_SETTINGS.

Prototype

String ACTION_WIFI_SETTINGS

To view the source code for android.provider Settings ACTION_WIFI_SETTINGS.

Click Source Link

Document

Activity Action: Show settings to allow configuration of Wi-Fi.

Usage

From source file:cordova.plugins.Diagnostic.java

public void switchToWifiSettings() {
    Log.d(TAG, "Switch to Wifi Settings");
    Intent settingsIntent = new Intent(Settings.ACTION_WIFI_SETTINGS);
    cordova.getActivity().startActivity(settingsIntent);
}

From source file:com.sonymobile.dronecontrol.activity.MainActivity.java

private boolean verifyWifi() {
    boolean result = false;
    WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    if (wifiManager.getWifiState() == WifiManager.WIFI_STATE_DISABLED) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("WiFi").setMessage(R.string.DG_CONNECT_TO_WIFI)
                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    @Override// w ww  .ja v a  2  s.c  o m
                    public void onClick(DialogInterface dialog, int which) {
                        startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
                        dialog.dismiss();
                    }
                }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                }).show();
    } else {
        result = true;
    }
    return result;
}

From source file:com.jungle.base.utils.MiscUtils.java

public static void openNetworkSetting(Context context) {
    Intent intent = null;//w w  w .  j  av a2  s .c om
    if (VersionUtils.getSystemVersion() > Build.VERSION_CODES.HONEYCOMB_MR2) {
        intent = new Intent(Settings.ACTION_WIFI_SETTINGS);
    } else {
        intent = new Intent(Settings.ACTION_SETTINGS);
    }

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

From source file:com.example.google.play.apkx.SampleDownloaderActivity.java

/**
 * If the download isn't present, we initialize the download UI. This ties
 * all of the controls into the remote service calls.
 *//*  w w  w.j  a  va2 s.  c  o m*/
private void initializeDownloadUI() {
    mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(this, SampleDownloaderService.class);
    setContentView(R.layout.main);

    mPB = (ProgressBar) findViewById(R.id.progressBar);
    mStatusText = (TextView) findViewById(R.id.statusText);
    mProgressFraction = (TextView) findViewById(R.id.progressAsFraction);
    mProgressPercent = (TextView) findViewById(R.id.progressAsPercentage);
    mAverageSpeed = (TextView) findViewById(R.id.progressAverageSpeed);
    mTimeRemaining = (TextView) findViewById(R.id.progressTimeRemaining);
    mDashboard = findViewById(R.id.downloaderDashboard);
    mCellMessage = findViewById(R.id.approveCellular);
    mPauseButton = (Button) findViewById(R.id.pauseButton);
    mWiFiSettingsButton = (Button) findViewById(R.id.wifiSettingsButton);

    mPauseButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mStatePaused) {
                mRemoteService.requestContinueDownload();
            } else {
                mRemoteService.requestPauseDownload();
            }
            setButtonPausedState(!mStatePaused);
        }
    });

    mWiFiSettingsButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
        }
    });

    Button resumeOnCell = (Button) findViewById(R.id.resumeOverCellular);
    resumeOnCell.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mRemoteService.setDownloadFlags(IDownloaderService.FLAGS_DOWNLOAD_OVER_CELLULAR);
            mRemoteService.requestContinueDownload();
            mCellMessage.setVisibility(View.GONE);
        }
    });

}

From source file:comingle.dragracing.TrackActivity.java

public void postConfigWifiConnection(final String msg) {
    if (postedWifiComplaint) {
        return;/*ww w. java2s .  com*/
    }
    postedWifiComplaint = true;
    final TrackActivity self = this;
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            AlertDialog.Builder alert = new AlertDialog.Builder(self);
            alert.setTitle("No Wifi-Direct Connection");
            alert.setMessage(msg);
            alert.setPositiveButton("Settings", new OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    self.startActivityForResult(new Intent(Settings.ACTION_WIFI_SETTINGS), RET_WIFI_SETTINGS);
                    dialog.dismiss();
                }
            });
            alert.setNegativeButton("Close", new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    self.finish();
                }
            });
            alert.show();
        }
    });
}

From source file:com.tml.sharethem.receiver.ReceiverActivity.java

protected void gotoWifiSettings() {
    try {/*from w ww  . ja  va 2 s  . c om*/
        startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
    } catch (ActivityNotFoundException anf) {
        Toast.makeText(this, "No Wifi listings feature found on this device", Toast.LENGTH_SHORT).show();
    }
}