List of usage examples for android.provider Settings ACTION_WIRELESS_SETTINGS
String ACTION_WIRELESS_SETTINGS
To view the source code for android.provider Settings ACTION_WIRELESS_SETTINGS.
Click Source Link
From source file:Main.java
public static void goToNetworkSetting(Context context) { Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); context.startActivity(intent); }
From source file:Main.java
/** * wireless settings// w w w.j ava 2 s . c o m * * @param context */ public static void wirelessSettings(Context context) { if (context == null) return; try { context.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } catch (ActivityNotFoundException e) { } catch (Exception e) { } }
From source file:com.mifirma.android.ActiveNfcDialog.java
@NonNull @Override/*from w ww .j a v a2 s .c o m*/ public Dialog onCreateDialog(final Bundle savedInstanceState) { return new AlertDialog.Builder(getActivity()) .setMessage("Su NFC esta deshabilitado Desea habilitarlo para usar DNIe 3.0?") .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { MainActivity.setUseNfc(false); dialog.dismiss(); } }).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { dialog.dismiss(); Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); startActivity(intent); } }).create(); }
From source file:net.evenh.chargingstations.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set default values PreferenceManager.setDefaultValues(this, R.xml.preferences, false); // Check for internet connectivity dialog = new AlertDialog.Builder(this).setTitle(R.string.internet_dialog_title) .setMessage(R.string.internet_dialog_message).setCancelable(true) .setNegativeButton(R.string.internet_dialog_cancel, new DialogInterface.OnClickListener() { @Override//from w w w .java2 s.c o m public void onClick(DialogInterface dialog, int which) { finish(); } }).setPositiveButton(R.string.internet_dialog_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (!hasClicked) { hasClicked = true; startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); hasClicked = false; } } }).create(); // Check for Google Play Services int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()); if (status == ConnectionResult.SUCCESS) { TabAdapter = new TabPagerAdapter(getFragmentManager()); Tab = (ViewPager) findViewById(R.id.pager); Tab.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar = getActionBar(); actionBar.setSelectedNavigationItem(position); } }); Tab.setAdapter(TabAdapter); actionBar = getActionBar(); //Enable Tabs on Action Bar if (actionBar != null) actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ActionBar.TabListener tabListener = new ActionBar.TabListener() { @Override public void onTabReselected(android.app.ActionBar.Tab tab, FragmentTransaction ft) { } @Override public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { Tab.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(android.app.ActionBar.Tab tab, FragmentTransaction ft) { } }; //Add New Tab actionBar.addTab(actionBar.newTab().setText(R.string.near_me).setIcon(R.drawable.ic_action_place) .setTabListener(tabListener)); actionBar.addTab(actionBar.newTab().setText(R.string.search).setIcon(R.drawable.ic_action_search) .setTabListener(tabListener)); } else { // Google Play Services error handling Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, -1); dialog.show(); } }
From source file:hobby.wei.c.phone.Network.java
public static void openNetGraceful(Context context) { try {/*from www . j a v a2s. c om*/ context.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } catch (Exception e) { context.startActivity(new Intent(Settings.ACTION_SETTINGS)); } }
From source file:ru.tinkoff.acquiring.sdk.nfc.NfcCardScanActivity.java
private void initNfc() { nfc = NfcAdapter.getDefaultAdapter(this); if (nfc == null) { return;//from w w w . j av a2 s .c om } nfcIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); if (!nfc.isEnabled()) { Toast.makeText(this, R.string.acq_nfc_need_enable, Toast.LENGTH_SHORT).show(); startActivityForResult(new Intent(Settings.ACTION_WIRELESS_SETTINGS), REQUEST_CODE_SETTINGS); } }
From source file:edu.cmu.cylab.starslinger.demo.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_MSG: showMessage(getString(R.string.dev_app_name_long), getString(R.string.dev_instruct)); return true; case MENU_NFC: if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { startActivity(new Intent(Settings.ACTION_NFC_SETTINGS)); } else {//w w w. j a v a 2s .c o m startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } break; default: break; } return false; }
From source file:com.example.prasadnr.traquad.TraQuad.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tra_quad); ConnectivityManager connManager = (ConnectivityManager) getSystemService(TraQuad.CONNECTIVITY_SERVICE); NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); Builder alert = new AlertDialog.Builder(TraQuad.this); WifiManager managerWifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); Method[] wmMethods = managerWifi.getClass().getDeclaredMethods(); for (Method method : wmMethods) { if (method.getName().equals("isWifiApEnabled")) { try { isWifiAPenabled = (boolean) method.invoke(managerWifi); } catch (IllegalArgumentException e) { e.printStackTrace();//from w w w.j a va 2 s . c o m } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } final ProgressDialog pDialog; MediaController mediaController = new MediaController(this); pDialog = new ProgressDialog(TraQuad.this); pDialog.setTitle("TraQuad app (Connecting...)"); pDialog.setMessage("Buffering...Please wait..."); pDialog.setCancelable(true); if (!isWifiAPenabled) { alert.setTitle("WiFi Hotspot Settings"); alert.setMessage("Can you please connect WiFi-hotspot?"); alert.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { irritation = true; startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); pDialog.show(); } }); alert.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //Dismiss AlertDialog pDialog.show(); Toast.makeText(getApplicationContext(), "Please connect your WiFi!", Toast.LENGTH_LONG).show(); } }); alert.setCancelable(false); AlertDialog alertDialog = alert.create(); alertDialog.show(); } WebView webView = (WebView) findViewById(R.id.webView); if (irritation == true | isWifiAPenabled) { pDialog.show(); } mediaController.setAnchorView(webView); mediaController.setVisibility(View.GONE); extra = getIntent().getStringExtra("VideosId"); webView = (WebView) findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setPluginState(WebSettings.PluginState.ON); final GlobalClass globalVariable = (GlobalClass) getApplicationContext(); final String IPaddressNew = globalVariable.getIP(); final String httpString = "http://"; final String commandPort = String.valueOf(1500); final String streamPort = String.valueOf(8080); final String IPaddressStream = httpString + IPaddressNew + ":" + streamPort; final String IPaddressCommand = httpString + IPaddressNew + ":" + commandPort; TextView sendCharacter = (TextView) findViewById(R.id.sendCharacter); try { webView.loadUrl(IPaddressStream); } catch (Exception e) { Toast.makeText(getApplicationContext(), IPaddressNew + ":Error!", Toast.LENGTH_LONG).show(); } webView.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { pDialog.dismiss(); } }); final Button switchact = (Button) findViewById(R.id.btn2); switchact.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent act1 = new Intent(view.getContext(), Joypad.class); startActivity(act1); } }); final Button hometraquad = (Button) findViewById(R.id.button5); hometraquad.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent acthometraquad = new Intent(TraQuad.this, MainActivity.class); startActivity(acthometraquad); } }); }
From source file:android.csulb.edu.wifidirecttest.WiFiDirectActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.atn_direct_enable: if (manager != null && channel != null) { // Since this is the system wireless settings activity, it's // not going to send us a result. We will be notified by // WiFiDeviceBroadcastReceiver instead. startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } else {//from w w w. j a va 2s . c o m Log.e(TAG, "channel or manager is null"); } return true; case R.id.atn_direct_discover: if (!isWifiP2pEnabled) { Toast.makeText(WiFiDirectActivity.this, R.string.p2p_off_warning, Toast.LENGTH_SHORT).show(); return true; } final DeviceListFragment fragment = (DeviceListFragment) getFragmentManager() .findFragmentById(R.id.frag_list); fragment.onInitiateDiscovery(); manager.discoverPeers(channel, new ActionListener() { @Override public void onSuccess() { Toast.makeText(WiFiDirectActivity.this, "Discovery Initiated", Toast.LENGTH_SHORT).show(); } @Override public void onFailure(int reasonCode) { Toast.makeText(WiFiDirectActivity.this, "Discovery Failed : " + reasonCode, Toast.LENGTH_SHORT) .show(); } }); return true; default: return super.onOptionsItemSelected(item); } }
From source file:se.anyro.nfc_reader.TagViewer.java
private void showWirelessSettingsDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.nfc_disabled); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); startActivity(intent);/*from ww w. ja v a2 s . co m*/ } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { finish(); } }); builder.create().show(); return; }