Is there any way to programmatically dismiss navigator.notification.alert()? I alert when there's a location services error, but if it clears, I'd prefer to dismiss it rather than require the user to do it manually.
Any ideas or solutions?
Thanks!
Hey i have got a change in java file for this. src/android/Notification.java
Added a reference to dlg.create()
First Declare this..
private AlertDialog alertbox;
Then add a case where you send "dismiss" from javascript
else if (action.equals("dismiss")) {
this.dismissAll();
}
Method to be added :
public void dismissAll(){
alertbox.dismiss();
}
Do remember to add the same in notification.js in www folder of notification plugin
dismiss: function(message, completeCallback, title, buttonLabel) {
var _title = (title || "Alert");//Doesnt Matter!
var _buttonLabel = (buttonLabel || "OK");//Doesnt Matter!
exec(completeCallback, null, "Notification", "dismiss", [message, _title, _buttonLabel]);
},
Now add
alertbox = dlg.create();
alertbox.show();
instead of
dlg.create();
dlg.show();
at all the places.
And you are good to go by calling
navigator.notification.dismiss("",null,"");
This will dismiss all the alerts / confirm / prompt opened.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With