Mike6580064
Posts: 0
Joined: Wed Jan 15, 2014 6:00 pm

Alert Handlers

With no connection (and entering the correct login credentials) I'm getting the no connection alert AND incorrect password alert upon button click.

I want to disable the incorrect password alert on button click if offline.

Mike6580064
Posts: 0
Joined: Wed Jan 15, 2014 6:00 pm

Alert Handlers

This did not work.

The offline doesn't clear from localStorage. If I turn my device's connection off then back on, I still get my "no connection" alert on login button click--regardless of correct login info or not.

I've shared the app "Digest of Tech..." with you guys if you wouldn't mind taking a look to see what I'm missing. These are my goals:

IF CONNECTED:
I want an "incorrect login" alert to fire on button click if incorrect credentials entered.

IF NOT CONNECTED:
I want a "no connection" alert to fire on page load AND on login button click (NOT "incorrect login" alert).

Thanks

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Alert Handlers

Hello Mike,

Set value of LSV as "offline" JavaScript event Run:

codelocalStorage.setItem ("offline", "true"); /code

Leave only Run for click for Login button. JavaScript with this code (remove the call to the service):

codefunction callBackFunctionB(){
console.log('OK');
}

if ("offline" in localStorage){
navigator.notification.alert(
"Your device has no connectivity",
callBackFunctionB,
'Connection Required'
);
} else {
login.execute({});
} /code

Mike6580064
Posts: 0
Joined: Wed Jan 15, 2014 6:00 pm

Alert Handlers

You guys are the best

Mike6580064
Posts: 0
Joined: Wed Jan 15, 2014 6:00 pm

Alert Handlers

I have tried running the navigator.notification.alert JS on a click of a label and am not getting any response when testing on the Appery mobile tester (iOS). Any ideas as to why this is?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Alert Handlers

Hi Mike,

This is because Appery.io tester opens applications as web apps, while navigator.notification.alert works for native applications only. Just install the app on device to make it work.

Mike6580064
Posts: 0
Joined: Wed Jan 15, 2014 6:00 pm

Alert Handlers

navigator.notification.alert works fine on a button click in the Appery mobile tester.

I installed the app on the device as well and got no response on a click of a label.

Mike6580064
Posts: 0
Joined: Wed Jan 15, 2014 6:00 pm

Alert Handlers

I changed the JS to fire on a Virtual Click instead of a Click and now it's working.

Mike6580064
Posts: 0
Joined: Wed Jan 15, 2014 6:00 pm

Alert Handlers

In testing this some more I've come across another issue.

If I disable my connection THEN run the app, I correctly get the "no connection" alert when I attempt to login.

If I CLOSE the app, THEN re-enable the connection, and THEN run the app again, I still get the "no connection" alert upon a login attempt--regardless of entering the correct credentials or not.

However, if I keep the app running while I toggle the connection on/off, everything functions correctly.

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

Alert Handlers

Mike,

Please share your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a, tell its name and steps to test this behavior.
Also please specify your device and its OS version.

Return to “Issues”