Page 1 of 5

Navigator.notification.alert not work correctly on real device and xcode simulater.

Posted: Sat Mar 15, 2014 6:10 am
by GodSpeed JP1

My navigator.notification.alert works on Appery.io Tester well.
But not work on real device and xocde simulater correctly.
I have text input check on page.When nothing inputed,will show alert when user try to submit.
But the alert did not show on real device,but interesting thing is when I double click the home button try to leave the app, the alert showed.
Please take a look at sreen shot below:
1.I input nothing in to the text area,then click the submit button right top.
Image

2.It should show alert here, but nothing's shown.
Image

3.When I double-click the home button ,the alert showed on background.
Image

It can not reproduce on Appery.io Tester.
It only can reproduce on xcode simulater and the real device.
Any thing wrong in my project?


Navigator.notification.alert not work correctly on real device and xcode simulater.

Posted: Sat Mar 15, 2014 6:37 am
by Alena Prykhodko

Hello,

Please tell us steps to reproduce (what code and on what Event you use to call alert)
What versions of iOS and xcode do you test on?


Navigator.notification.alert not work correctly on real device and xcode simulater.

Posted: Sat Mar 15, 2014 7:13 am
by GodSpeed JP1

Hello Alena,
My device version is iOS 7.06.
Xcode version is 5.0.2.
Xcode simulater version is 7.0.

The submit button call event "Click" and run javascript below:
//////////////////////////////////////////////////////
//cheak commenttxt
var commenttxt = Appery('comment').val();
if (isNull(commenttxt)) {
showAlert("Please input some comment","Check");
return;
}
//////////////////////////////////////////////////////
My method "showAlert" is:
function showAlert(message, title, buttonName) {
buttonName = buttonName "Confirm";
title = title "Warning";
if (isNotNull(navigator) && isNotNull(navigator.notification)) {
navigator.notification.alert(message, // message
alertDismissed, // callback
title, // title
buttonName // buttonName
);
} else {
alert(message);
}
}

/////////////////////////////////////////////////////////////
// call back method
function alertDismissed() {
// do nothing
}

// is not null check
function isNotNull(value) {
var res = false;
if (typeof value !== "undefined" && value !== null && value !== "" && jQuery.trim(value) !== "" && value !== "undefined") {
res = true;
}
return res;
}

// is null check
function isNull(value) {
return (!isNotNull(value));
}


Navigator.notification.alert not work correctly on real device and xcode simulater.

Posted: Sat Mar 15, 2014 9:12 pm
by Igor

When you test app in the browser are there any errors in browser console?


Navigator.notification.alert not work correctly on real device and xcode simulater.

Posted: Sun Mar 16, 2014 3:51 am
by GodSpeed JP1

Hi Igor,navigator is a phonegap object , can not test in browser.


Navigator.notification.alert not work correctly on real device and xcode simulater.

Posted: Sun Mar 16, 2014 10:20 pm
by Illya Stepanov

Hi - please try the following construction for the codenavigator.notification.alert();/code
pre
...
navigator.notification.alert(
'Message - You Win!', // your message
alertDismissed, // callback
'Game Over', // your title
'Done' // your buttonName
);
...
/pre


Navigator.notification.alert not work correctly on real device and xcode simulater.

Posted: Mon Mar 17, 2014 3:59 am
by GodSpeed JP1

Hi Illya, I have been using that construction.
You can find it in my first comment.The function "showAlert".
//////////////////////////////////////////////////////
function showAlert(message, title, buttonName) {
buttonName = buttonName "Confirm";
title = title "Warning";
if (isNotNull(navigator) && isNotNull(navigator.notification)) {
navigator.notification.alert(message, // message
alertDismissed, // callback
title, // title
buttonName // buttonName
);
} else {
alert(message);
}
}


Navigator.notification.alert not work correctly on real device and xcode simulater.

Posted: Mon Mar 17, 2014 5:54 pm
by Maryna Brodina

Hello! Could you clarify what is your libraries version?


Navigator.notification.alert not work correctly on real device and xcode simulater.

Posted: Tue Mar 18, 2014 12:36 am
by GodSpeed JP1

Hello Maryna,
Do you mean libraries version in App setting?
It is v2.0(jQuery(1.9.1),jQuery Mobile(1.4.0),PhoneGap(3.3.0))
I will upload the pictrue below.
Or you need any information else?


Navigator.notification.alert not work correctly on real device and xcode simulater.

Posted: Tue Mar 18, 2014 12:37 am
by GodSpeed JP1

App setting Libraries version:
Image