Phonegap:如何只显示一次配置屏幕

Phonegap: How to show configuration screen only once

我已经开始在 Phonegap 上工作,Native App 开发人员很难选择 Hybrid。

只是想知道如何在 Phonegap 中只显示一次配置屏幕。下面是屏幕截图。我只想在用户第一次运行应用程序时显示它,而不是在用户启动应用程序并保存 IP 地址时一次又一次地显示它。

这里的问题是,每当我按下设备的 back 按钮时,都会显示此屏幕。

这是我的 HTML:

<body>

<div data-role="page" id="pageConfig"> // This Div needs to show only first time

    <div class="ui-content" data-role="main">
        <h3>Configurations</h3>

        <label for="ipText">IP Address:</label>
        <input type="url" id="ipText" name="ipText" />
        <a href="#" class="ui-btn ui-btn-b ui-corner-all mc-top-margin-1-5" onclick="saveConfigs()">Save</a>
    </div>

</div>

<div data-role="page" id="pgLgn">

    <div data-role="main" class="ui-content">
        <form id="form1" class="validate">

            <div class="ui-field-contain">
                <label for="usrNme">Username:</label>
                <input type="text" name="usrNme" id="usrNme" placeholder="Username" data-clear-btn="true" data-theme="d" class="required" />
            </div>

            <div class="ui-field-contain">
                <label for="pswrd">Password:</label>
                <input type="password" name="pswrd" id="pswrd" placeholder="Password" data-clear-btn="true" data-theme="d" class="required" />
            </div>

            <div class="ui-field-contain">
                <input type="checkbox" id="chbx-0" class="custom" data-inline="true" />
                <label for="chbx-0">Remember me</label>
            </div>

            <input type="submit" data-inline="true" value="Login" id="btnLogin" data-shadow="false" data-theme="a" onclick="OnLoginClick()"/>
            <input type="reset" data-inline="true" value="Reset" data-shadow="false" />

        </form>
    </div>
</div>
</body>

我需要什么 Cordova 插件

注意: 我正在使用 Jquery Mobile 和 Cordova SQLite 插件进行数据存储。我的应用程序是单页架构。

提前致谢!

如有不明之处请告知

你必须在设备就绪函数中写下这一行。

document.addEventListener("backbutton",onBackKeyDown,false);

function onBackKeyDown(){

 if($.mobile.activePage.attr("id") == "pgLgn"){
            navigator.app.exitApp();
        }
        else{
            navigator.app.backHistory();
}
}

使用localStorage。保存一个带键的简单字符串,并在deviceready函数中检查是否有针对键的特定值。