Example usage for android.provider Settings ACTION_APPLICATION_DEVELOPMENT_SETTINGS

List of usage examples for android.provider Settings ACTION_APPLICATION_DEVELOPMENT_SETTINGS

Introduction

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

Prototype

String ACTION_APPLICATION_DEVELOPMENT_SETTINGS

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

Click Source Link

Document

Activity Action: Show settings to allow configuration of application development-related settings.

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);//w w w. j  a  v a  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.farmerbb.taskbar.fragment.FreeformModeFragment.java

@TargetApi(Build.VERSION_CODES.N)
@Override//  w w w  . ja  va  2  s.c o  m
public boolean onPreferenceClick(final Preference p) {
    final SharedPreferences pref = U.getSharedPreferences(getActivity());

    switch (p.getKey()) {
    case "freeform_hack":
        if (((CheckBoxPreference) p).isChecked()) {
            if (!U.hasFreeformSupport(getActivity())) {
                ((CheckBoxPreference) p).setChecked(false);

                AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                builder.setTitle(R.string.freeform_dialog_title).setMessage(R.string.freeform_dialog_message)
                        .setPositiveButton(R.string.action_developer_options, (dialogInterface, i) -> {
                            showReminderToast = true;

                            Intent intent = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS);
                            try {
                                startActivity(intent);
                                U.showToastLong(getActivity(), R.string.enable_force_activities_resizable);
                            } catch (ActivityNotFoundException e) {
                                intent = new Intent(Settings.ACTION_DEVICE_INFO_SETTINGS);
                                try {
                                    startActivity(intent);
                                    U.showToastLong(getActivity(), R.string.enable_developer_options);
                                } catch (ActivityNotFoundException e2) {
                                    /* Gracefully fail */ }
                            }
                        });

                AlertDialog dialog = builder.create();
                dialog.show();
                dialog.setCancelable(false);
            }

            if (pref.getBoolean("taskbar_active", false) && getActivity().isInMultiWindowMode()
                    && !FreeformHackHelper.getInstance().isFreeformHackActive()) {
                U.startFreeformHack(getActivity(), false, false);
            }
        } else {
            LocalBroadcastManager.getInstance(getActivity())
                    .sendBroadcast(new Intent("com.farmerbb.taskbar.FINISH_FREEFORM_ACTIVITY"));
            LocalBroadcastManager.getInstance(getActivity())
                    .sendBroadcast(new Intent("com.farmerbb.taskbar.FORCE_TASKBAR_RESTART"));
        }

        break;
    case "freeform_mode_help":
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setView(View.inflate(getActivity(), R.layout.freeform_help_dialog, null))
                .setTitle(R.string.freeform_help_dialog_title).setPositiveButton(R.string.action_close, null);

        AlertDialog dialog = builder.create();
        dialog.show();
        break;
    case "add_shortcut":
        Intent intent = U.getShortcutIntent(getActivity());
        intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
        intent.putExtra("duplicate", false);

        Intent homeIntent = new Intent(Intent.ACTION_MAIN);
        homeIntent.addCategory(Intent.CATEGORY_HOME);
        ResolveInfo defaultLauncher = getActivity().getPackageManager().resolveActivity(homeIntent,
                PackageManager.MATCH_DEFAULT_ONLY);

        intent.setPackage(defaultLauncher.activityInfo.packageName);
        getActivity().sendBroadcast(intent);

        U.showToast(getActivity(), R.string.shortcut_created);
        break;
    case "window_size":
        if (U.isOPreview()) {
            U.showToast(getActivity(), R.string.window_sizes_not_available);
        }

        break;
    }

    return true;
}

From source file:co.lemonlabs.android.slidingdebugmenu.SlidingDebugMenu.java

@SuppressWarnings("ConstantConditions")
@Override//from ww w  .  jav  a 2 s. co m
public void onClick(View v) {
    final int id = v.getId();
    Context context = getContext();

    if (id == R.id.sdm__settings_developer) {
        // open dev settings
        Intent devIntent = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS);
        ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(devIntent, 0);
        if (resolveInfo != null)
            context.startActivity(devIntent);
        else
            Toast.makeText(context, "Developer settings not available on device", Toast.LENGTH_SHORT).show();

    } else if (id == R.id.sdm__settings_battery) {
        // try to find an app to handle battery settings
        Intent batteryIntent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
        ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(batteryIntent, 0);
        if (resolveInfo != null)
            context.startActivity(batteryIntent);
        else
            Toast.makeText(context, "No app found to handle power usage intent", Toast.LENGTH_SHORT).show();

    } else if (id == R.id.sdm__settings_drawer) {
        // open android settings
        context.startActivity(new Intent(Settings.ACTION_SETTINGS));

    } else if (id == R.id.sdm__settings_app_info) {
        Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.setData(Uri.parse("package:" + context.getPackageName()));
        context.startActivity(intent);

    } else if (id == R.id.sdm__settings_uninstall) {
        // open dialog to uninstall app
        Uri packageURI = Uri.parse("package:" + context.getPackageName());
        Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
        context.startActivity(uninstallIntent);
    }
}

From source file:com.xortech.sender.SenderMain.java

/**
 * METHOD TO ASK USER TO DISABLE "DON'T KEEP ACTIVITIES" IN DEVELOPER OPTIONS
 *//*from w  w  w .ja v  a2 s .c o  m*/
public void showDeveloperOptionsScreen() {

    new AlertDialog.Builder(this).setTitle("Developer Options Detected!").setMessage(
            "In order for Sender to work properly, please uncheck the \"Don't keep activities\" option.")
            .setNegativeButton(android.R.string.no, null)
            .setPositiveButton(android.R.string.yes, new OnClickListener() {

                public void onClick(DialogInterface arg0, int arg1) {
                    Intent intent = new Intent(
                            android.provider.Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS);
                    intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
                    startActivity(intent);
                    finish();
                }
            }).create().show();
}

From source file:org.broeuschmeul.android.gps.usb.provider.driver.USBGpsManager.java

/**
 * Disables the Usb GPS provider.//from   w w  w .j  ava2s .  c om
 * <p>
 * It will:
 * <ul>
 * <li>close the connection with the bluetooth device</li>
 * <li>disable the Mock Location Provider used for the bluetooth GPS</li>
 * <li>stop the BlueGPS4Droid service</li>
 * </ul>
 * If the bluetooth provider is closed because of a problem, a notification is displayed.
 */
public synchronized void disable() {
    notificationManager.cancel(R.string.connection_problem_notification_title);

    if (getDisableReason() != 0) {
        NotificationCompat.Builder partialServiceStoppedNotification = serviceStoppedNotificationBuilder
                .setWhen(System.currentTimeMillis()).setAutoCancel(true)
                .setContentTitle(appContext
                        .getString(R.string.service_closed_because_connection_problem_notification_title))
                .setContentText(
                        appContext.getString(R.string.service_closed_because_connection_problem_notification,
                                appContext.getString(getDisableReason())));

        // Make the correct notification to direct the user to the correct setting
        if (getDisableReason() == R.string.msg_mock_location_disabled) {
            PendingIntent mockLocationsSettingsIntent = PendingIntent.getActivity(appContext, 0,
                    new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS),
                    PendingIntent.FLAG_CANCEL_CURRENT);

            partialServiceStoppedNotification.setContentIntent(mockLocationsSettingsIntent)
                    .setStyle(new NotificationCompat.BigTextStyle().bigText(appContext.getString(
                            R.string.service_closed_because_connection_problem_notification,
                            appContext.getString(R.string.msg_mock_location_disabled_full))));

        } else if (getDisableReason() == R.string.msg_no_location_permission) {
            PendingIntent mockLocationsSettingsIntent = PendingIntent.getActivity(appContext, 0,
                    new Intent(callingService, GpsInfoActivity.class), PendingIntent.FLAG_CANCEL_CURRENT);

            USBGpsApplication.setLocationNotAsked();

            partialServiceStoppedNotification.setContentIntent(mockLocationsSettingsIntent)
                    .setStyle(new NotificationCompat.BigTextStyle().bigText(appContext.getString(
                            R.string.service_closed_because_connection_problem_notification,
                            appContext.getString(R.string.msg_no_location_permission))));
        }

        Notification serviceStoppedNotification = partialServiceStoppedNotification.build();
        notificationManager.notify(R.string.service_closed_because_connection_problem_notification_title,
                serviceStoppedNotification);

        sharedPreferences.edit()
                .putInt(appContext.getString(R.string.pref_disable_reason_key), getDisableReason()).apply();
    }

    if (enabled) {
        debugLog("disabling USB GPS manager");
        callingService.unregisterReceiver(permissionAndDetachReceiver);

        enabled = false;
        connectionAndReadingPool.shutdown();

        Runnable closeAndShutdown = new Runnable() {
            @Override
            public void run() {
                try {
                    connectionAndReadingPool.awaitTermination(10, TimeUnit.SECONDS);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

                if (!connectionAndReadingPool.isTerminated()) {
                    connectionAndReadingPool.shutdownNow();
                    if (connectedGps != null) {
                        connectedGps.close();
                    }

                }
            }
        };

        notificationPool.execute(closeAndShutdown);
        nmeaListeners.clear();
        disableMockLocationProvider();
        notificationPool.shutdown();
        callingService.stopSelf();

        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putBoolean(USBGpsProviderService.PREF_START_GPS_PROVIDER, false);
        editor.apply();

        debugLog("USB GPS manager disabled");
    }
}