在BB 10上安装我的apk文件

时间:2014-10-13 06:41:21

标签: android cordova blackberry-10 phonegap-build

HELLO我迫切需要你的帮助,我使用phonegap为Android构建一个移动应用程序,它工作正常,没关系,但最近我想有相同的应用程序的BB10版本,我了解到你轻松安装apk文件最新的BB10到目前为止d apk文件已签名。我做了所有这些并且应用程序已成功安装在BB10上但我遇到的问题是该应用程序与数据库的通信不良(如尝试登录或注册不工作将继续加载)这不是在android上。

所以请问我能做些什么来解决这个问题,非常高兴收到你的回复,非常感谢

下面是PLS这个工作的代码很好用安德鲁如此签名的钥匙我安装在BB10上它已经成功但是与数据库进行通信。当用户想要登录BB10时,它会在加载页面上激活(激活帐户)。

<!DOCTYPE html> 
<html>
<head>
<meta charset="utf-8">
<title>Registration</title>
<link rel="stylesheet" type="text/css" href="themes/ad_Direct.min.css" />
<link rel="stylesheet" type="text/css" href="themes/jquery.mobile.icons.min.css" />
<link rel="stylesheet" type="text/css" href="jquery-mobile/jquery.mobile.structure-1.4.0.min.css" />
<link rel="stylesheet" type="text/css" href="themes/custom.css" />
<script src="jquery-mobile/jquery-1.11.0.min.js" type="text/javascript"></script>
<script>
$(document).delegate('a.top', 'click', function () {
    $.mobile.silentScroll(0);
    return false;
});
</script>
<script>
    function createUser(username,password,firstname,lastname,phone,email,address,accountname,bank,accountno)
    {
        x = document.getElementById("regform");
        if (bank == "Select Your Bank" && (accountname.length != 0 | accountno.length != 0))
        {
            //if(accountname.length == 0 && accountno.length == 0)
            //{
                //bank = ""
            //}
            //if (accountname.length > 0 | accountno.length > 0)
            //{
                alert ("Please select your bank")
            //}
        }

        else if(x.elements["termsofuse"].checked)
        {
            $('.loading').css('display','block');

            var xmlhttp;
            if (window.XMLHttpRequest)
            {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }
            else
            {// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }

            xmlhttp.onreadystatechange=function()
            {
              if (xmlhttp.readyState==4 && xmlhttp.status==200)
              {

                    document.getElementById("ajax_response").innerHTML = xmlhttp.responseText
                    if (xmlhttp.responseText == "User added successfully")
                    {
                        $('.loading').css('display','none');
                        alert("User added successfully.")
                        //window.location.href = ("registration.html#page3")
                        window.location.href = "registration.html?username="+username+"#page2";
                    }
                    else if (xmlhttp.responseText == "Username already taken")
                    {
                        $('.loading').css('display','none');
                        alert ("BB PIN already registered")
                    }

                    else if (xmlhttp.responseText == "Email address already exists")
                    {
                        $('.loading').css('display','none');
                        alert ("Email address already exists")
                    }
              }
            }


        xmlhttp.open("POST","http://addirectng.com/mobile_scripts/add_user.php",true);
        xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        xmlhttp.send("username="+username+"&password="+password+"&firstname="+firstname+"&lastname="+lastname+"&phone="+phone+"&email="+email+"&address="+address+"&accountname="+accountname+"&bank="+bank+"&accountno="+accountno);

        }

        else 
        {
            alert("You must agree to the terms of use")
            //document.getElementById("ajax_response").innerHTML("You must agree to the terms of use")
        }

}

    function validateEntry()
    {
        var x = document.getElementById("regform");  
        //txt = txt + x.elements[i].value + "<br>";  
        var username = x.elements["username"].value.trim()
        var password = x.elements["password"].value.trim()
        var firstname = x.elements["firstname"].value.trim()
        var lastname = x.elements["lastname"].value.trim()
        var phone = x.elements["phone"].value.trim()
        var email = x.elements["email"].value.trim()
        var address = x.elements["address"].value.trim()
        var accountname = x.elements["accountname"].value.trim()
        var bank = x.elements["bank"].value
        var accountno = x.elements["accountno"].value.trim()

        var valid = ""

        valid = validateUsername(username)
        valid += validatePassword(password)
        //validateFirstName(firstname)
        //validateLastName(lastname)
        //validatePhone(phone)
        valid += validateEmail(email)
        //validateAddress(address)
        //validateAccountName(accountname)
        //validateBank(bank)
        //validateAccountNo(accountno)

        if (valid == "")
        {
            createUser(username,password,firstname,lastname,phone,email,address,accountname,bank,accountno)
        }
        else alert (valid)

    }

    function validateUsername(username)
    {
        if (username.length == 0) return "Please enter your BB PIN \n"  
        else if (username.length != 8)  return "BB PIN should have 8 characters \n"
        else if (/[^A-Za-z0-9]/.test(username)) return "Only alphabets and numbers are allowed  in BB PIN \n"
        else return ""
    }
    function validatePassword(password)
    {
        if (password.length == 0) return "Please enter a password \n"   
        else if (password.length < 6 | password.length > 15) return "Password should have between 6 and 15 characters \n"
        else return ""
    }
    function validateEmail(value)
    {
        if(value.length == 0) return "Please enter an email address \n"
        else if (!/^[A-Za-z0-9_-]*@[A-Za-z0-9_-]*.[A-Za-z]{2,4}$/.test(value)) return "Please enter a valid email address \n"
        else return ""
    }

    function verifyCode()
    {
        $('.loading').css('display','block');
        activationCode = document.getElementById('textinput').value.trim();
        username = getUrlVars()["username"];    
        //alert (username)

        $.post("http://addirectng.com/mobile_scripts/verify_activation_code.php",
        {
            uname:username,
            actCode:activationCode
        },
        function(data,status){
            if (data == "Activation code wrong")
            {
                $('.loading').css('display','none');
                alert ("Wrong activation code entered");    
            }
            else if (data == "Your account has been activated")
            {
                $('.loading').css('display','none');
                alert ("Your account has been activated. Please login to continue")
                window.location.href = "index.html#page3"
            }
        });

    }

    function getUrlVars() 
    {
        var vars = {};
        var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&#]*)/gi, function(m,key,value) 
        {
            vars[key] = value;
        });
        return vars;
    }

        //document.getElementById("ajax_response").innerHTML(username +" "+ firstname +" "+lastname);
    //}
</script>
<script src="jquery-mobile/jquery.mobile-1.4.0.js" type="text/javascript"></script>
<!--<script src="themes/signup.js" type="text/javascript"></script> -->
</head> 

<body>

        <div data-role="page" id="page" data-theme="a">
                <div data-role="header">
                    <h1>Register Here</h1> 

                </div>

                <div data-role="content" id="top2" data-theme="a">
                                    <h2> Sign Up </h2>
                                    <h5>Please fill the Form below to become a D.A.P</h5>

                        <p id="ajax_response" style="color:red;"></p>


                    <h3>Personal Information</h3>

                    <form id="regform">
                    <div data-role="fieldcontain">
                        <label for="username">BB Pin (Username):</label>
                        <input type="text" name="username" id="username" value=""  />
                    </div>

                    <div data-role="fieldcontain">
                        <label for="password">Password:</label>
                        <input type="password" name="password" id="password" value=""  />
                    </div>

                    <div data-role="fieldcontain">
                        <label for="firstname">First Name:</label>
                        <input type="text" name="firstname" id="firstname" value=""  />
                    </div>

                    <div data-role="fieldcontain">
                        <label for="lastname">Last Name:</label>
                        <input type="text" name="lastname" id="lastname" value=""  />
                    </div>

                    <div data-role="fieldcontain">
                        <label for="phone">Mobile Phone No:</label>
                        <input type="text" name="phone" id="phone" value=""  />
                    </div>

                    <div data-role="fieldcontain">
                        <label for="email">Email:</label>
                        <input type="text" name="email" id="email" value=""  />
                    </div>

                    <div data-role="fieldcontain">
                        <label for="">Address:</label>
                        <textarea name="address" id="address" value=""></textarea>
                    </div>

                    <h3>Your Bank Details</h3>

                    <div data-role="fieldcontain">
                            <label for="accountName">Account Name*:</label>
                            <input name="accountname" type="text" id="accountName" value="" />
                    </div>

                    <div data-role="fieldcontain">
                            <label for="bank" class="select">Select Your Bank:</label>
                            <select name="bank" id="bank">
                                    <option>Select Your Bank</option>
                                    <option value="Guaranty Trust Bank">Guaranty Trust Bank</option>
                                    <option value="Access Bank">Access Bank</option>
                                    <option value="Zenith Bank">Zenith Bank</option>
                                    <option value="Ecobank">Ecobank</option>
                                    <option value="Keystone Bank">Keystone Bank</option>
                                    <option value="UBA">UBA</option>
                                    <option value="First Bank">First Bank</option>
                                    <option value="Diamond Bank">Diamond Bank</option>
                                    <option value="Union Bank">Union Bank</option>
                                    <option value="Fidelity Bank">Fidelity Bank</option>
                                    <option value="CitiBank">CitiBank</option>
                                    <option value="Enterprise Bank">Enterprise Bank</option>
                                    <option value="First City Monument Bank-FCMB">First City Monument Bank-FCMB</option>
                                    <option value="FSDH Merchant Bank">FSDH Merchant Bank</option>
                                    <option value="Heritage Bank">Heritage Bank</option>
                                    <option value="Mainstreet Bank">Mainstreet Bank</option>
                                    <option value="Road Merchant Bank">Road Merchant Bank</option>
                                    <option value="Savannah Bank">Savannah Bank</option>
                                    <option value="Skye Bank">Skye Bank</option>
                                    <option value="Stanbic IBTC Bank">Stanbic IBTC Bank</option>
                                    <option value="Sterling Bank">Sterling Bank</option>
                                    <option value="Union Bank">Union Bank</option>
                                    <option value="Unity Bank">Unity Bank</option>
                                    <option value="Wema Bank">Wema Bank</option>
                          </select>
                    </div>

                    <div data-role="fieldcontain">
                          <label for="accountno">Account No:</label>
                          <input type="text" name="accountno" id="accountno" value=""  />
                    </div>


                    <div data-role="collapsible"><h2>Read Terms of Use</h2>

            </div>

                    <div data-role="fieldcontain">
                          <fieldset data-role="controlgroup">
                              <legend></legend>
                                <input type="checkbox" name="termsofuse" id="checkbox1_0" class="pop" />
                                <label for="checkbox1_0">I agree with the Terms of Use</label>
                          </fieldset>
                    </div>

                    <div class="loading">
                            <p>Creating account...</p>
                            <img src="images/ajax-loader.gif" />
                    </div>

                    <p class="improvised_button"  onClick="validateEntry()">Submit</p>

                    </form>
                </div>

                <div data-role="footer" data-position="fixed" data-id="main-footer">
                    <div data-role="controlgroup" data-type="horizontal" style="float:left;">
                            <a href="index.html"  rel="external" data-role="button" data-icon="grid" data-iconpos="left">Menu</a>
                            <a href="#top2" data-role="button" data-icon="arrow-u" data-iconpos="left" class="top" data-ajax="false">Back to Top</a>
                                                <a onClick="exit()" data-role="button" class="hidden">Exit</a>
                    </div>

                    <div style="color:#FFF; font-size:12px; float:right; padding-top:15px; display:inline;">&copy; 2014</div>
                </div>
        </div>

        <div data-role="page" id="page2" data-theme="a">
                <div data-role="header">
                    <h1>Congratulations</h1>
                </div>

                <div data-role="content" data-theme="a">
                    <h3>You are Welcome on Board</h3>
                    <p>Congratulations!!! You have successfully become a MEMBER.Please activate your account by entering the activation code that was sent to your mailbox and start making MONEY!. </p>

                    <div data-role="fieldcontain">
                        <label for="textinput" id="activationCode">Activation Code Here:</label>
                        <input type="text" name="textinput" id="textinput" value=""  />

                    </div>

                    <div class="loading">
                            <p>Activating account...</p>
                            <img src="images/ajax-loader.gif" />
                    </div>

                    <p class='improvised_button' onClick="verifyCode()">Submit</p>
                </div>

                <div data-role="footer" data-position="fixed" data-id="main-footer">
                        <div data-role="controlgroup" data-type="horizontal" style="float:left;">
                                <a href="index.html" rel="external" data-role="button" data-icon="grid" data-iconpos="left">Menu</a>
                        </div>

                        <div style="color:#FFF; font-size:12px; float:right; padding-top:15px; display:inline;">&copy; Ad-Direct 2014</div>
                </div>
        </div>

        <div data-role="page" id="page3" data-theme="a">
                <div data-role="header">
                    <h1>You are Done!</h1>
                </div>

                <div data-role="content" data-theme="a">
                    <h3>You are Welcome on Board</h3>
                    <p>Go to <a href="index.html#page3" rel="external">Login Page</a> to access your your Account</p>
                </div> 

                <div data-role="footer" data-position="fixed" data-id="main-footer">
                    <div data-role="controlgroup" data-type="horizontal" style="float:left;">
                    <a href="index.html" rel="external" data-role="button" data-icon="grid" data-iconpos="left">Menu</a>
                                <a onClick="exit()" data-role="button" class="hidden">Exit</a>
                    </div>

                    <div style="color:#FFF; font-size:12px; float:right; padding-top:15px; display:inline;">&copy; Ad-Direct 2014</div>
                </div>
        </div>
    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
    <script type="text/javascript">
            app.initialize();
    </script>
</body>
</html>

0 个答案:

没有答案