OpenSettings plugin cordova
I have installed the OpenSettings plugin via node.js
using this command in my project:
cordova plugin add https://github.com/erikhuisman/cordova-plugin-opensettings.git
But when I use the OpenSettings.setting()
logcat method , it returns me an error:
OpenSettings.settings error in File: ///android_asset/www/plugins/nl.tapme.cordova.opensettings/www/OpenSettings.js: 23
This 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;
});
Can anyone help me?
+3
source to share
1 answer
I would suggest you test this plugin -> https://github.com/selahssea/Cordova-open-native-settings , the first one you posted already did not work for me either.
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);
Complete snippet :
function settingsSuccess() {
console.log('settings opened');
}
function settingsFail() {
console.log('open settings failed');
}
function openSettingsNow() {
cordova.plugins.settings.open(settingsSuccess,settingsFail);
}
+3
source to share