gpt4 book ai didi

javascript - 打开设置插件 cordova

转载 作者:行者123 更新时间:2023-11-29 10:39:26 25 4
gpt4 key购买 nike

我安装了插件OpenSettings通过 node.js 在我的项目中使用此命令:

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

但是当我使用方法 OpenSettings.setting() 时,logcat 返回一个错误:

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

这是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;

});

谁能帮帮我?

最佳答案

我建议你测试这个插件 -> https://github.com/selahssea/Cordova-open-native-settings你发布的第一个已经对我不起作用了。

像这样安装它:

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

并像这样使用它:

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

完整片段:

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

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

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

插件将打开此概览:enter image description here

关于javascript - 打开设置插件 cordova,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31589718/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com