cordova - Execute javascript code from android service when app is closed -


i want execute javascript function native android when application closed.

i have service in android , called javascript function every hour or minutes this:

private class maintask extends timertask {      public void run()      {        fireevent("event", null);          //this calls webview.sendjavascript(js);     } }     

this working while application still in foreground, calls javascript function in hybrid part,

but when closed/kill app service still running , fireevent function , webview.sendjavascript(js) still executed javascript function not executed anymore.

this js:

cordova.plugins.background.event = function () {     console.log("background mode on active");     //also put javascript notification here know if executed. } 

am missing or not possible execute javascript code if application close?

if app closed... can't execute code of app.

you could: 1. execute code outside of app... (but maybe not want) 2. try launch again silently app (not sure if can service)


Comments