-
Notifications
You must be signed in to change notification settings - Fork 318
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
Using WkWebWkit disables javascript execution/callback when app enters background #127
Comments
Hi @johnrobertcobbold, two questions on your findings: I updated to cordova iOS 4 – do I now automatically use WKWebView instead of UIWebView or whats the matter with the cordova-plugin-wkwebview-engine plugin? Respectively: How/Where did you remove WKWebView and switched back to UIView? As I'm getting the failure notice #123 I'm assuming I'm using it, do I? |
|
I have the same issue, I am going to try the UIwebview and see if that fixes the issue knowing that it breaks Hot-code pushes. but if it makes the app work again then I guess it might be worth it. |
This didn't seem to work, the url is back to http://localhost so I am pretty sure its back to UIWebView, but the app got kicked out and failed to reload and execute. I will try further but it really depends on the devices use. |
@goyavo this thread is over a year old, but did you manage to get it working / remember what the solution was, if there was any? I have a similar use-case (tracking users location and play audio and load data when they reach a geofence, works well in foreground on iOS and Android, and in background in Android (i use the cordova-plugin-background-mode), but not in iOS. I see the logs with updating the position, and also the js code is executed up until where a $http.get request has to be done, suddenly the file can't be loaded (I use the cordova-labs-local-webserver as well, to serve the files needed for the Ionic 1 App). |
On IOS the app fails to reLaunch in order to process the transition change. This need to be remodelled to have the Plugin talk directly back to the server via API bypassing the need to reload the web server. |
Have been bumping my head for the past 36h on this and I finally seem to understand what is going on. I don't see any solution but perhaps this can stir some discussion / help others.
Using UIview and this plugin, I can successfully do the following when a geofence receives a transition :
1> Trigger a JS callback when the app is in the foreground
2> Trigger a JS callback when the app is in the background (user pressed home button, app is still alive)
3> Trigger a JS callback when the app was terminated (by user or OS)
However, after implementing WkWebWkit with Cordova iOS 4, cordova-plugin-wkwebview-engine and the master version of cordova-plugin-geofence, I realize that 2> does not work anymore...
From what I understand after some research is that WKWebView changes the way javascript runs (separate process?) and all JS execution is stopped when the app is backgrounded.
Case 3> still works as the OS launches the app from scratch.
After removing WkWebWkit and switching back to using UIView, it's all back to normal and 2> works once again. I am slightly surprised as no-one seems to be discussing this ? I am the only one to use custom JS callbacks ?
Some relevant material encountered during my research :
http://stackoverflow.com/questions/26514090/wkwebview-does-not-run-javascriptxml-http-request-with-out-adding-a-parent-vie
http://www.openradar.me/17680867
The text was updated successfully, but these errors were encountered: