Page 1 of 1

navigator.notification.confirm

Posted: Wed Jan 07, 2015 4:33 am
by Bruce Stuart

Hello,

I'm using this code to call the Cordova plugin's for notifications. On my IOS device (and appearantly on the android as well) - Im getting an error message when calling it.

My code:

function confirmdismissed( nbuttonpressed ) {
if ( nbuttonpressed === 1 ) {
nbutton = nbuttonpressed ;
bconfirmed = true ;
}
else {
nbutton = nbuttonpressed ;
bconfirmed = false ;
}

}
function myConfirm(smessage, fcallback , stitle , abuttons ) {
console.log('in myconfirm');
if (stitle === undefined) {
stitle = 'Confirm';
}
if (abuttons === undefined) {
abuttons = ["Ok", "Cancel"];
}
if (fcallback === undefined) {
fcallback = 'confirmdismissed';
}
navigator.notification.confirm(
smessage, // message
fcallback, // callback
stitle, // title
abuttons ); // buttonName
return bconfirmed ;
}

Error message in the IOS simulator log:

Jan 4 15:05:18 localhost TrueBlue COA[24579]: The old format of this exec call has been removed (deprecated since 2.1). Change to: cordova.exec(null, null, "", "confirmdismissed",[null,"Notification","confirm",["Logout ? ","Confirm",["Ok","Cancel"]]]);

so, question, can you help me interpret this error ? what's the right format for the call ?

thanks,
Bruce


navigator.notification.confirm

Posted: Wed Jan 07, 2015 5:57 am
by Yurii Orishchuk

Hi Bruce,

It's seems the common cordova issue with old plugins.

Read more details here: https://github.com/shazron/phonegap-q...

Regards.


navigator.notification.confirm

Posted: Thu Jan 08, 2015 12:18 am
by Bruce Stuart

Yurii,

Thanks. I poked around after your response ... And was looking at other posts here, and the docs from Cordova.... Seems my error for the time being was two things:

  1. When sending along the callback method, I was enclosing it it quotes like this:
    fcallback = 'confirmdismissed'

    Since what's happening is the function actually needs to be assigned to the variable not the string name of it... The code needs to be:

    fcallback = confirmdismissed. // no quotes

    And viola ... It works...

  2. I needed to realize that on the IOS and Android platforms ... Confirm is NON blocking ... So life continues in your code regardless of response ... Unless you put the activity to be completed .... In the callback method :-) ... Unlike what you might do on an HTML site where confirm is blocking.

    I ended up with HYBRID code that works regardless of platform ... Using a hint offered earlier here to, at startup , assign the confirm and alert functions to the Cordova functions if they exist after 'device ready'.

    Thnaks again,
    Bruce


navigator.notification.confirm

Posted: Thu Jan 08, 2015 4:50 am
by Yurii Orishchuk

Hi Bruce,

Thanks for this update.

Regards.


navigator.notification.confirm

Posted: Sun Jan 11, 2015 2:27 pm
by Alex7321365

Hi,
I get this error when I try to use notification.dialogs plugin :
The old format of this exec call has been removed (deprecated since 2.1). Change to: cordova.exec(null, null, "",

Which file I need to update ??

Thanks for your help.

Alex.


navigator.notification.confirm

Posted: Tue Jan 13, 2015 11:12 pm
by Yurii Orishchuk

Hi Alex,

Please give us your app public link and describe steps to reproduce this problem in your app.

Regards.


navigator.notification.confirm

Posted: Wed Jan 14, 2015 12:59 am
by Yurii Orishchuk

Hi Alex,

I've tried this plugin - and it works correctly for me.

It seems you have some other custom plugins that disables cordova to start.

Please check weinre debugger at start of your app.. If you will see something like:

pre

Channel not fired: onPluginsReady
Channel not fired: onCordovaReady

/pre

it means - you have wrongly include some phonegap/cordova plugin.

Regards.