capacitor-community/text-to-speech

feat (settings): Open Native Settings

dtrigo opened this issue · 0 comments

Is your feature request related to a problem? Please describe:
It would be great to implement a method to launch system's TTS Settings.

Describe the solution you'd like:
A new method like

@PluginMethod
    public void openTTSSettings(PluginCall call) {
        JSObject ret = new JSObject();
        final PackageManager manager = getContext().getPackageManager();
        Intent launchIntent = new Intent("com.android.settings.TTS_SETTINGS");

        try {
            getActivity().startActivity(launchIntent);
            ret.put("completed", true);
        } catch (Exception ex) {
            launchIntent = manager.getLaunchIntentForPackage(url);
            try {
                getActivity().startActivity(launchIntent);
                ret.put("completed", true);
            } catch (Exception expgk) {
                ret.put("completed", false);
            }
        }
        call.resolve(ret);
    }