Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

openSettings plugin cordova

I installed the plugin OpenSettings via node.js with this command in my project:

cordova plugin add https://github.com/erikhuisman/cordova-plugin-opensettings.git

But when I use method OpenSettings.setting() logcat return me an error:

OpenSettings.settings error at file:///android_asset/www/plugins/nl.tapme.cordova.opensettings/www/OpenSettings.js:23

This is OpenSettings.js:

cordova.define("nl.tapme.cordova.opensettings.OpenSettings", function(require, exports, module) { module.exports = OpenSettings = {};

OpenSettings.settings = function(app, callback) {
    cordova.exec(
        // Success callback
        callback,
        // Failure callback
        function(err) { console.log('OpenSettins.settings error'); },
        // Native Class Name
        "OpenSettings",
        // Name of method in native class.
        "settings",
        // array of args to pass to method.
        []
    );
};

OpenSettings.bluetooth = function (app, callback) {
    cordova.exec(
        // Success callback
        callback,
        // Failure callback
        function(err) { console.log('OpenSettings.bluetooth error'); },
        // Native Class Name
        "OpenSettings",
        // Name of method in native class.
        "bluetooth",
        // array of args to pass to method.
        []
    );
};

OpenSettings.bluetoothStatus = function (app, callback) {
    cordova.exec(
        // Success callback
        callback,
        // Failure callback
        function(err) { console.log('OpenSettins.bluetoothStatus error'); },
        // Native Class Name
        "OpenSettings",
        // Name of method in native class.
        "bluetoothStatus",
        // array of args to pass to method.
        []
    );
};

OpenSettings.bluetoothChange = function (callback) {
    cordova.exec(
        // Success callback
        callback,
        // Failure callback
        function(err) { console.log('OpenSettins.bluetoothChange error'); },
        // Native Class Name
        "OpenSettings",
        // Name of method in native class.
        "bluetoothChange",
        // array of args to pass to method.
        []
    );
};

return OpenSettings;

});

Anyone can help me?

like image 466
Gianni Pasqua Avatar asked Nov 21 '25 02:11

Gianni Pasqua


1 Answers

I would suggest you to test this plugin -> https://github.com/selahssea/Cordova-open-native-settings the first one you posted already did not work for me too.

Install it like this:

cordova plugin add https://github.com/selahssea/Cordova-open-native-settings.git

and use it like this:

cordova.plugins.settings.open(settingsSuccess,settingsFail);

Full snippet:

function settingsSuccess() {
    console.log('settings opened');
}

function settingsFail() {
    console.log('open settings failed');
}

function openSettingsNow() {
    cordova.plugins.settings.open(settingsSuccess,settingsFail);
}

The plugin will open this overview: enter image description here

like image 124
Sithys Avatar answered Nov 23 '25 14:11

Sithys



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!