-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
app is relaunched despite being open on android #348
Comments
It might be related to android platform's behavior, which is documented in cordova's platform guide. In your case, it's quite possible that the android system killed your MainActivity when you're opening another browesr, and then restored it afterwards. If your test device is not that lack of resources, the problem does not happen everytime, is it? |
It's been consistent, on both a physical test phone I have and a simulated pixel phone. Is there any "easy" way to save state and restore it, maybe you know about this ? Because as far as I'm aware I'd have to save stuff to a file and read it again on resume, but the app is quite complex so this would be very tedious. |
To save the states, I just use JS local storage. Does that work for you? Are there some other inconvenience that you encountered? I understand that at least your JS variables have lost. In my case the <config-file target="res/xml/config.xml" parent="/*">
<feature name="LaunchMyApp">
<param name="android-package" value="nl.xservices.plugins.LaunchMyApp"/>
+ <param name="onload" value="true" />
</feature>
</config-file> to plugin.xml's android part |
Thanks that might help. And yeah my variables are lost, the View/Component/Page that the user had opened are also lost, inputs in forms, etc... All of this makes up to why its very tedious to save the state of the app. I don't really have any other problem regarding this plugin otherwise. |
So I've skimmed a bit through issues and read the doc, and I couldnt find a definite answer to this. On iOS if my app is already opened it will call the handler keeping the state of the app however on android it re-launches the app and then calls the handler.
This is kinda painful as im using the handler for an oauth process where I need a user to connect to an external webpage opened in the system browser and then redirected to the app using this plugin.
Is there any way to not re-launch the app and call the handler ? Or is this a bug ?
The text was updated successfully, but these errors were encountered: