Red-Folder / bgs-core

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

running cordova inside of a service #89

Closed andrewvmail closed 5 years ago

andrewvmail commented 6 years ago

has anyone have any success running a headless browser inside a service with cordova plugins wired in. i was able to get the browser part running but cant seem to figure out how to initialize the plugins inside or a service

Cheers AT

Red-Folder commented 6 years ago

So you want to run a headless browser from within the service execution context?

andrewvmail commented 6 years ago

Yeah I got the headless browser part working with XWalkInitializer, but having a hard time with getting cordova running in it. I actually found someone figured it out with the regular WebView here and it works but on my project I have to use crosswalk. I guess the issue is the XWalkWebViewEngine is more sensitive than the SystemWebViewEngine so the hack doesn't work

Long story short I don't need to this anymore because I found what I want to do with this

But out of curiosity, wondering if anyone else ever got cordova inside a service. The way I imagine it is you write a service in JS and have 2 independent JS runtime. Not sure maybe this is architecturally and fundamentally a bad idea thats why its so hard to get this working ...

While writing just stumbled on to this android-cheats-and-tips-invisible-activity I'm new to native android but I guess this might work too.

Just for closure I probably will play around some more to test out that idea.

tagging this other issue I think the guy might find this interesting, since im working on a similar app

Cheers

Red-Folder commented 6 years ago

What are you actually trying to achieve (functional outcome rather than technical solution)?

It feels as if the architecture is very complex.

andrewvmail commented 6 years ago

Wake up the app on a silent push message then either download some messages or connect an incoming call. should work when app is killed or when app is in background after all that should disconnect and cleanup after it self.

I guess your right it does feels kinda complex

Red-Folder commented 6 years ago

I'd advise you have a look at push messaging (Google Cloud Messaging).

If you see https://developers.google.com/cloud-messaging/, the description for Downstream Messaging:

... kicking off background processing...

I've not used myself so could comment on how easy it would be to use - but there is a lot of "noise" about this sort of technology - so I'd expect a lot of samples floating around. Good luck