Example usage for android.provider Settings ACTION_DATA_ROAMING_SETTINGS

List of usage examples for android.provider Settings ACTION_DATA_ROAMING_SETTINGS

Introduction

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

Prototype

String ACTION_DATA_ROAMING_SETTINGS

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

Click Source Link

Document

Activity Action: Show settings for selection of 2G/3G.

Usage

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);/*from w w w .  j  av a2 s . c  om*/
    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:me.yoctopus.smarttips.MainActivity.java

@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    listener = new OnInteractionListener() {
        @Override/*ww w .  j av  a  2s.  c o  m*/
        public void onLike(Tips tips) {
        }

        @Override
        public void onDislike(Tips tips) {

        }
    };
    ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
    if (networkInfo != null && networkInfo.isConnected()) {
        refreshLayout.post(new Runnable() {
            @Override
            public void run() {
                refreshLayout.setRefreshing(true);
                loadTips();
                requestNewInterstitial();
            }
        });
    } else {
        Notification notification = new Notification(this);
        notification.showDialog("Network Request",
                "Please enable network " + "connection in order" + "to retrieve betting tips",
                new NDialog.DButton("Enable", new NDialog.DButton.BListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);
                        startActivity(intent);

                    }
                }), null, null);
    }
}

From source file:cordova.plugins.Diagnostic.java

public void switchToMobileDataSettings() {
    Log.d(TAG, "Switch to Mobile Data Settings");
    Intent settingsIntent = new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);
    cordova.getActivity().startActivity(settingsIntent);
}

From source file:com.elekso.potfix.MainActivity.java

private void showNetDisabledAlertToUser() {
    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
    alertDialogBuilder.setMessage("Internet will improve accuracy. Would you like to enable it?")
            .setCancelable(false).setPositiveButton("Enable Internet", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    Intent callGPSSettingIntent = new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);
                    startActivity(callGPSSettingIntent);
                }//w w  w  . jav  a 2 s  . com
            });
    alertDialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });
    AlertDialog alert = alertDialogBuilder.create();
    alert.show();
}

From source file:com.openarc.nirmal.nestle.LoginActivity.java

private void noWarningDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this, R.style.AlertDialogStyle);
    builder.setMessage(getString(R.string.warning_internet_disable)).setCancelable(false)
            .setPositiveButton(R.string.btn_txt_yes, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    startActivity(new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS));
                }/*from w  w w . ja  v  a 2 s  . co m*/
            }).setNegativeButton(R.string.btn_txt_no, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();
                }
            });
    final AlertDialog alert = builder.create();
    alert.show();
}

From source file:org.mixare.MixViewActivity.java

public void setErrorDialog(int error) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setCancelable(false);// w ww.j a  v a 2s .c  o  m
    switch (error) {
    case NO_NETWORK_ERROR:
        builder.setMessage(getString(R.string.connection_error_dialog));
        break;
    case GPS_ERROR:
        builder.setMessage(getString(R.string.gps_error_dialog));
        break;
    case GENERAL_ERROR:
        builder.setMessage(getString(R.string.general_error_dialog));
        break;
    case UNSUPPORTED_HARDWARE:
        builder.setMessage(getString(R.string.unsupportet_hardware_dialog));
        break;
    }

    /*Retry*/
    builder.setPositiveButton(R.string.connection_error_dialog_button1, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            // "restart" mixare
            startActivity(
                    new Intent(MixContext.getInstance().getApplicationContext(), PluginLoaderActivity.class));
            finish();
        }
    });
    if (error == GPS_ERROR) {
        /* Open settings */
        builder.setNeutralButton(R.string.connection_error_dialog_button2,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        try {
                            Intent intent1 = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                            startActivityForResult(intent1, 42);
                        } catch (Exception e) {
                            Log.d(Config.TAG, "No Location Settings");
                        }
                    }
                });
    } else if (error == NO_NETWORK_ERROR) {
        builder.setNeutralButton(R.string.connection_error_dialog_button2,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        try {
                            Intent intent1 = new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);
                            ComponentName cName = new ComponentName("com.android.phone",
                                    "com.android.phone.Settings");
                            intent1.setComponent(cName);
                            startActivityForResult(intent1, 42);
                        } catch (Exception e) {
                            Log.d(Config.TAG, "No Network Settings");
                        }
                    }
                });
    }
    /*Close application*/
    builder.setNegativeButton(R.string.connection_error_dialog_button3, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            finish();
        }
    });

    AlertDialog alert = builder.create();
    alert.show();
}

From source file:info.zamojski.soft.towercollector.MainActivity.java

private Intent createDataRoamingSettingsIntent() {
    Intent intent = new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);
    // Theoretically this is not needed starting from 4.0.1 but it sometimes fail
    // bug https://code.google.com/p/android/issues/detail?id=13368
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
        ComponentName componentName = new ComponentName("com.android.phone", "com.android.phone.Settings");
        intent.setComponent(componentName);
    }/*from   w  ww  . ja  v  a 2s  .c  o m*/
    return intent;
}