Red-Folder / bgs-core

Core code for the Cordova Background Service
Other
236 stars 105 forks source link

It's Possible MyService.java Call Javascript Function ? #91

Closed RizkaOMG closed 6 years ago

RizkaOMG commented 6 years ago

I try make MyService.java run some function from javascript because when user clear all recent app function on app will be stop but MyService.java stiil running. It's possible to call JS function in MyService.java ? because I need notification when APP closed. I used local notification from cordova. I already used javax.script but it show error when I build android. Thanks

Red-Folder commented 6 years ago

No, there is no method to run JavaScript from MyService.java if the Cordova instance has been killed.

I would advise moving converting your logic from JavaScript to Jave and running within MyService.java

If however, you are just pushing notifications to your app - I'd suggest looking at something like Google Cloud Messaging instead

iamisti commented 6 years ago

@Red-Folder do you think it is possible to call a third party android library from 'MyService'? Can you put me on the track and tell me how if it's possible? Thanks a lot in advance!

iamisti commented 6 years ago

wow that was a nice answer :D