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:org.kde.necessitas.ministro.MinistroActivity.java
private void checkNetworkAndDownload(final boolean update) { if (isOnline(this)) new CheckLibraries().execute(update); else {/* w w w .j a va 2 s . c o m*/ AlertDialog.Builder builder = new AlertDialog.Builder(MinistroActivity.this); builder.setMessage(getResources().getString(R.string.ministro_network_access_msg)); builder.setCancelable(true); builder.setNeutralButton(getResources().getString(R.string.settings_msg), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { final ProgressDialog m_dialog = ProgressDialog.show(MinistroActivity.this, null, getResources().getString(R.string.wait_for_network_connection_msg), true, true, new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { finishMe(); } }); getApplication().registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (isOnline(MinistroActivity.this)) { try { getApplication().unregisterReceiver(this); } catch (Exception e) { e.printStackTrace(); } runOnUiThread(new Runnable() { public void run() { m_dialog.dismiss(); new CheckLibraries().execute(update); } }); } } }, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); try { startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } catch (Exception e) { e.printStackTrace(); try { startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); } catch (Exception e1) { e1.printStackTrace(); } } dialog.dismiss(); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { finishMe(); } }); AlertDialog alert = builder.create(); alert.show(); } }
From source file:com.example.healthplus.wifidirect.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 ww w. ja v a 2 s . c om 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 WifiP2pManager.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:hr.foicore.varazdinlandmarksdemo.POIMapActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_poi_map); SupportMapFragment smf = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.f_map); gmm = new GoogleMapsModule(POIMapActivity.this, smf); if (gmm.googleMap != null) { // get and set map type from settings selectedMapType = getSelectedGoogleMapType(); switchGoogleMapType(selectedMapType); gmm.addAllMarkers(POIMapActivity.this); gmm.googleMap.setOnMapClickListener(POIMapActivity.this); gmm.googleMap.setOnMarkerClickListener(POIMapActivity.this); gmm.googleMap.setOnInfoWindowClickListener(POIMapActivity.this); // Setting a custom info window adapter for the google map gmm.googleMap.setInfoWindowAdapter(new InfoWindowAdapter() { // Use default InfoWindow frame @Override//from w ww . ja v a 2s . c o m public View getInfoWindow(Marker marker) { return null; } // Defines the contents of the InfoWindow @Override public View getInfoContents(Marker marker) { // Getting view from the layout file info_window_layout View v = getLayoutInflater().inflate(R.layout.custom_infowindow_popup, null); TextView tv; tv = (TextView) v.findViewById(R.id.snippet); tv.setText(marker.getSnippet()); // Returning the view containing InfoWindow contents return v; } }); } tvMapMessage = (TextView) findViewById(R.id.tv_map_message); tvMapMessage.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (!gmm.internetEnabled) { POIMapActivity.this.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } else if (!gmm.myLocationEnabled) { startActivityForResult(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS), 0); } } }); tvMapDirectionsInfo = (TextView) findViewById(R.id.tv_map_directions_info); lockOrientation(); }
From source file:com.phonegap.plugins.nativesettings.NativeSettings.java
@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { PluginResult.Status status = PluginResult.Status.OK; Uri packageUri = Uri.parse("package:" + this.cordova.getActivity().getPackageName()); String result = ""; //Information on settings can be found here: //http://developer.android.com/reference/android/provider/Settings.html action = args.getString(0);/* w w w . java 2 s . co m*/ Intent intent = null; if (action.equals("accessibility")) { intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS); } else if (action.equals("account")) { intent = new Intent(android.provider.Settings.ACTION_ADD_ACCOUNT); } else if (action.equals("airplane_mode")) { intent = new Intent(android.provider.Settings.ACTION_AIRPLANE_MODE_SETTINGS); } else if (action.equals("apn")) { intent = new Intent(android.provider.Settings.ACTION_APN_SETTINGS); } else if (action.equals("application_details")) { intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, packageUri); } else if (action.equals("application_development")) { intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS); } else if (action.equals("application")) { intent = new Intent(android.provider.Settings.ACTION_APPLICATION_SETTINGS); } //else if (action.equals("battery_saver")) { // intent = new Intent(android.provider.Settings.ACTION_BATTERY_SAVER_SETTINGS); //} else if (action.equals("bluetooth")) { intent = new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS); } else if (action.equals("captioning")) { intent = new Intent(android.provider.Settings.ACTION_CAPTIONING_SETTINGS); } else if (action.equals("cast")) { intent = new Intent(android.provider.Settings.ACTION_CAST_SETTINGS); } else if (action.equals("data_roaming")) { intent = new Intent(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS); } else if (action.equals("date")) { intent = new Intent(android.provider.Settings.ACTION_DATE_SETTINGS); } else if (action.equals("about")) { intent = new Intent(android.provider.Settings.ACTION_DEVICE_INFO_SETTINGS); } else if (action.equals("display")) { intent = new Intent(android.provider.Settings.ACTION_DISPLAY_SETTINGS); } else if (action.equals("dream")) { intent = new Intent(android.provider.Settings.ACTION_DREAM_SETTINGS); } else if (action.equals("home")) { intent = new Intent(android.provider.Settings.ACTION_HOME_SETTINGS); } else if (action.equals("keyboard")) { intent = new Intent(android.provider.Settings.ACTION_INPUT_METHOD_SETTINGS); } else if (action.equals("keyboard_subtype")) { intent = new Intent(android.provider.Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS); } else if (action.equals("storage")) { intent = new Intent(android.provider.Settings.ACTION_INTERNAL_STORAGE_SETTINGS); } else if (action.equals("locale")) { intent = new Intent(android.provider.Settings.ACTION_LOCALE_SETTINGS); } else if (action.equals("location")) { intent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); } else if (action.equals("manage_all_applications")) { intent = new Intent(android.provider.Settings.ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS); } else if (action.equals("manage_applications")) { intent = new Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS); } else if (action.equals("memory_card")) { intent = new Intent(android.provider.Settings.ACTION_MEMORY_CARD_SETTINGS); } else if (action.equals("network")) { intent = new Intent(android.provider.Settings.ACTION_NETWORK_OPERATOR_SETTINGS); } else if (action.equals("nfcsharing")) { intent = new Intent(android.provider.Settings.ACTION_NFCSHARING_SETTINGS); } else if (action.equals("nfc_payment")) { intent = new Intent(android.provider.Settings.ACTION_NFC_PAYMENT_SETTINGS); } else if (action.equals("nfc_settings")) { intent = new Intent(android.provider.Settings.ACTION_NFC_SETTINGS); } //else if (action.equals("notification_listner")) { // intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS); //} else if (action.equals("print")) { intent = new Intent(android.provider.Settings.ACTION_PRINT_SETTINGS); } else if (action.equals("privacy")) { intent = new Intent(android.provider.Settings.ACTION_PRIVACY_SETTINGS); } else if (action.equals("quick_launch")) { intent = new Intent(android.provider.Settings.ACTION_QUICK_LAUNCH_SETTINGS); } else if (action.equals("search")) { intent = new Intent(android.provider.Settings.ACTION_SEARCH_SETTINGS); } else if (action.equals("security")) { intent = new Intent(android.provider.Settings.ACTION_SECURITY_SETTINGS); } else if (action.equals("settings")) { intent = new Intent(android.provider.Settings.ACTION_SETTINGS); } else if (action.equals("show_regulatory_info")) { intent = new Intent(android.provider.Settings.ACTION_SHOW_REGULATORY_INFO); } else if (action.equals("sound")) { intent = new Intent(android.provider.Settings.ACTION_SOUND_SETTINGS); } else if (action.equals("store")) { intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + this.cordova.getActivity().getPackageName())); } else if (action.equals("sync")) { intent = new Intent(android.provider.Settings.ACTION_SYNC_SETTINGS); } else if (action.equals("usage")) { intent = new Intent(android.provider.Settings.ACTION_USAGE_ACCESS_SETTINGS); } else if (action.equals("user_dictionary")) { intent = new Intent(android.provider.Settings.ACTION_USER_DICTIONARY_SETTINGS); } else if (action.equals("voice_input")) { intent = new Intent(android.provider.Settings.ACTION_VOICE_INPUT_SETTINGS); } else if (action.equals("wifi_ip")) { intent = new Intent(android.provider.Settings.ACTION_WIFI_IP_SETTINGS); } else if (action.equals("wifi")) { intent = new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS); } else if (action.equals("wireless")) { intent = new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS); } else { status = PluginResult.Status.INVALID_ACTION; callbackContext.sendPluginResult(new PluginResult(status, result)); return false; } if (args.length() > 1 && args.getBoolean(1)) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } this.cordova.getActivity().startActivity(intent); callbackContext.sendPluginResult(new PluginResult(status, result)); return true; }
From source file:com.google.android.apps.paco.FindExperimentsActivity.java
public void showNetworkConnectionActivity() { try {//from w w w . j a v a 2 s.c o m startActivityForResult(new Intent(Settings.ACTION_WIRELESS_SETTINGS), DownloadHelper.ENABLED_NETWORK); } catch (Exception e) { } }
From source file:com.luke.lukef.lukeapp.tools.LukeUtils.java
/** * Checks the current Internet status, if Internet is not enabled then calls * {@link LukeUtils#alertDialogBuilder(Context, String, String)} to create a prompt for the user * to enable Internet./*from w w w. ja v a 2s. c o m*/ * * @param context Context, needed to create the alert. * @return <b>true</b> if the GPS is enabled, <b>false</b> if it's not. */ public static boolean checkInternetStatus(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo != null && netInfo.isConnectedOrConnecting()) { return true; } else { alertDialogBuilder(context, noInternet, Settings.ACTION_WIRELESS_SETTINGS); return false; } }
From source file:com.stanleyidesis.quotograph.api.controller.LWQNotificationControllerImpl.java
@Override public void postWallpaperGenerationFailureNotification() { // Two actions: Network Settings & Try Again LWQApplication context = LWQApplication.get(); // Establish basic options NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context); notificationBuilder.setAutoCancel(true); notificationBuilder.setCategory(//from w w w . j av a2 s. c o m Build.VERSION.SDK_INT > 21 ? Notification.CATEGORY_ERROR : Notification.CATEGORY_SERVICE); notificationBuilder.setColor(LWQApplication.get().getResources().getColor(R.color.palette_A100)); notificationBuilder.setContentInfo(context.getString(R.string.app_name)); notificationBuilder.setContentTitle(context.getString(R.string.notification_generation_failure_title)); notificationBuilder.setContentText(context.getString(R.string.notification_generation_failure_content)); notificationBuilder.setLights(LWQApplication.get().getResources().getColor(R.color.palette_A100), 500, 500); notificationBuilder.setTicker(context.getString(R.string.notification_generation_failure_ticker)); notificationBuilder.setOngoing(false); notificationBuilder.setShowWhen(true); notificationBuilder.setLocalOnly(true); notificationBuilder.setPriority(NotificationCompat.PRIORITY_MIN); notificationBuilder.setSmallIcon(android.R.drawable.stat_notify_error); notificationBuilder.setWhen(System.currentTimeMillis()); // Create BigTextStyle NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle(); bigTextStyle.setBigContentTitle(context.getString(R.string.notification_generation_failure_title)); bigTextStyle.bigText(context.getString(R.string.notification_generation_failure_content)); notificationBuilder.setStyle(bigTextStyle); // Add Settings Action Intent settingsIntent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); final PendingIntent settingsBroadcast = PendingIntent.getActivity(context, uniqueRequestCode++, settingsIntent, 0); final NotificationCompat.Action settingsAction = new NotificationCompat.Action.Builder( R.mipmap.ic_settings_white, context.getString(R.string.notification_generation_failure_action_settings), settingsBroadcast) .build(); notificationBuilder.addAction(settingsAction); // Add Skip Action Intent skipIntent = new Intent(context, LWQReceiver.class); skipIntent.setAction(context.getString(R.string.action_change_wallpaper)); skipIntent.setData(Uri.parse(AnalyticsUtils.URI_CHANGE_SOURCE_NOTIFICATION)); final PendingIntent skipBroadcast = PendingIntent.getBroadcast(context, uniqueRequestCode++, skipIntent, 0); final NotificationCompat.Action skipAction = new NotificationCompat.Action.Builder( R.mipmap.ic_refresh_white_36dp, context.getString(R.string.notification_generation_failure_action_try_again), skipBroadcast) .build(); notificationBuilder.addAction(skipAction); // Set Skip as main action notificationBuilder.setContentIntent(skipBroadcast); NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(NOTIF_ID_GEN_FAILURE, notificationBuilder.build()); }
From source file:com.example.android.wifidirect.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 ww w. ja va 2 s.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) getSupportFragmentManager().findFragmentByTag("devicelistfragment"); FileTransmitFragment fileTransmitfragment = (FileTransmitFragment) getSupportFragmentManager() .findFragmentByTag("android:switcher:" + R.id.pager + ":0"); final DeviceListFragment fragment = (DeviceListFragment) fileTransmitfragment.getFragmentManager() .findFragmentById(R.id.frag_list); fragment.onInitiateDiscovery(); manager.discoverPeers(channel, new WifiP2pManager.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:com.dragon4.owo.ar_trace.ARCore.MixView.java
public void setErrorDialog() { // ?? ? ?/*from w w w . j a v a2s . com*/ AlertDialog.Builder builder = new AlertDialog.Builder(this); // ?? ? builder.setMessage(getString(DataView.CONNECTION_ERROR_DIALOG_TEXT)); builder.setCancelable(false); // ? ? /*Retry*/ builder.setPositiveButton(DataView.CONNECTION_ERROR_DIALOG_BUTTON1, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { fError = false; //TODO improve try { repaint(); // ? } catch (Exception ex) { // ? doError(ex); } } }); /*Open settings*/ builder.setNeutralButton(DataView.CONNECTION_ERROR_DIALOG_BUTTON2, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // ?? Intent intent1 = new Intent(Settings.ACTION_WIRELESS_SETTINGS); startActivityForResult(intent1, 42); } }); /*Close application*/ builder.setNegativeButton(DataView.CONNECTION_ERROR_DIALOG_BUTTON3, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { System.exit(0); // ? } }); AlertDialog alert = builder.create(); alert.show(); // ? }
From source file:com.polyvi.xface.extension.XAppExt.java
/** * ?componen//w w w . j a v a2s .c om * * @param componenName * ??componen?? return true??,false? */ private boolean startSystemComponent(int componentCode) { SysComponent componentName = SysComponent.UNKNOWN; try { componentName = SysComponent.values()[componentCode]; } catch (ArrayIndexOutOfBoundsException e) { XLog.d(CLASS_NAME, "unkown component name!", e); return false; } Intent intent = null; boolean success = false; switch (componentName) { case VPN_CONFIG: intent = new Intent("android.net.vpn.SETTINGS"); break; case WIRELESS_CONFIG: intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); break; case GPS_CONFIG: intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); break; default: XLog.d(CLASS_NAME, "unkown component name!"); break; } if (null != intent) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getContext().startActivity(intent); success = true; } return success; }