簡體   English   中英

openSettings插件cordova

[英]openSettings plugin cordova

我在項目中使用此命令通過node.js安裝了插件OpenSettings

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

但是當我使用方法OpenSettings.setting() logcat返回一個錯誤:

文件中的OpenSettings.settings錯誤:///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);
}

該插件將打開此概述: 在此輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM