Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
17060 Discussions

Cordova notification error

Nick_F_2
New Contributor III
904 Views

Hi 

Been building the same app for a while now, made some minor changes and now I get an error when attempting to display a notification.alert.

Wondered why this was happening as my alerts no longer appear.

The old format of this exec call has been removed (deprecated since 2.1). Change to: cordova.exec(null, null, "", "Error",[null,"Notification","alert",["The verification code or your name is entered incorrectly","OK","OK"]]);

This error does not occur on App Preview or under emulation, only when the app is installed on iOS, the Android version seems OK.

0 Kudos
4 Replies
Anusha_M_Intel1
Employee
904 Views

Could you post your Cordova Alert code?

0 Kudos
Nick_F_2
New Contributor III
904 Views

My Code is below, I have changed the URL for security, there error occurs here navigator.notification.alert("The verification code or your name is entered incorrectly", "Error","OK");

function getTeams(sel) {
    $("#teamslist").empty();
    $("#mydetails").empty();
    var myfirst = $("#firstname").val();
    var mylast = $("#lastname").val();
    var myname = myfirst+" "+mylast;
    var mydiv = $("#division").val();
    var vcode = $("#vcode").val();
    if (mydiv != "[Select Division]") {
    localStorage.setItem("mydiv", mydiv);
    var sqlstr = "http://myurl/getdata.php?div="+mydiv+"&vcode="+vcode+"&yourname="+myname;
    var xhr = new XMLHttpRequest();
    xhr.open("GET",sqlstr,false);
    xhr.onload = function(){
        if(xhr.status==200)
        {
        jsonArray = $.parseJSON(xhr.responseText);
            if (jsonArray.length == 1) {
             for(i=0; i < jsonArray.length; i++)
                       {
                       team = jsonArray.team;
                       localStorage.setItem("myteam", jsonArray.team);
                       //document.getElementById("team").value = jsonArray.team;
                       }
            setTeam();
            }
            else
            {
              navigator.notification.alert("The verification code or your name is entered incorrectly", "Error","OK");  
            }
        }
        else if(xhr.status == 404)
    {
        navigator.notification.alert("Web Service Doesn't Exist", "Error","OK");
    }
    else
    {
       navigator.notification.alert("Unknown error occured while connecting to server", "Error","OK");
    }
}
}
xhr.send()
}

0 Kudos
Nick_F_2
New Contributor III
904 Views

I think I may have answered my own question, I had missed the callback option out of the navigator.notification.alert options, I have now added null (As there is no callback) and it seems to have fixed the issue.

0 Kudos
Anusha_M_Intel1
Employee
904 Views

That's great!

0 Kudos
Reply