apache / cordova-discuss

Discussions on features and the future
19 stars 28 forks source link

Cordova and Multi-Window #80

Open jake-white opened 7 years ago

jake-white commented 7 years ago

Has there been any progress in finding a solution for this multi-window support? As it has described here, the Cordova activty is destroyed and restarted whenever being resized, and along with it goes the webview. My users have reported this, and since my javascript does locally store some values relating to the session and inputs, this causes some annoyance.

Not sure if this is the place for this or if this project is still active, but wondering if anyone has found a workaround. Thanks.

pliablepixels commented 6 years ago

This issue has been open for a while, and I haven't seen an update. I recently came across this issue myself.

If it helps, I scraped together a plugin for multi-window operation so that we can continue running ur apps in multi-window mode. https://github.com/pliablepixels/cordova-plugin-multi-window

It looks like we need to handle multiple things:

  1. In multi-window mode, when you switch to a different app, the other app gets an onPause() but you really don't want to clean up your resources because its not going to the background. To solve this, we need access to onStart() and onStop() which this plugin provides

  2. I also exposed an api to check if you are running in multi-window mode

  3. The activity does get restarted - if someone would like to do a PR to fix that - it would be great. I believe its got something to do with adding some key to the android manifest (resizable:true) - I tried but maybe I did something wrong.