GodSpeed JP1
Posts: 0
Joined: Thu Feb 27, 2014 1:23 pm

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

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?

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

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

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?

GodSpeed JP1
Posts: 0
Joined: Thu Feb 27, 2014 1:23 pm

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

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));
}

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

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

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

GodSpeed JP1
Posts: 0
Joined: Thu Feb 27, 2014 1:23 pm

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

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

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

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

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

GodSpeed JP1
Posts: 0
Joined: Thu Feb 27, 2014 1:23 pm

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

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);
}
}

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

Hello! Could you clarify what is your libraries version?

GodSpeed JP1
Posts: 0
Joined: Thu Feb 27, 2014 1:23 pm

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

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?

Return to “Issues”