[英]openSettings plugin cordova
I installed the plugin OpenSettings via node.js
with this command in my project: 我在项目中使用此命令通过node.js
安装了插件OpenSettings :
cordova plugin add https://github.com/erikhuisman/cordova-plugin-opensettings.git
But when I use method OpenSettings.setting()
logcat return me an error: 但是当我使用方法OpenSettings.setting()
logcat返回一个错误:
OpenSettings.settings error at file:///android_asset/www/plugins/nl.tapme.cordova.opensettings/www/OpenSettings.js:23 文件中的OpenSettings.settings错误:///android_asset/www/plugins/nl.tapme.cordova.opensettings/www/OpenSettings.js:23
This is OpenSettings.js
: 这是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? 有人可以帮帮我吗?
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. 我建议你测试这个插件 - > https://github.com/selahssea/Cordova-open-native-settings你发布的第一个也不适合我。
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);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.