The Phonegap deviceready event is fired only when the application loses focus

I installed the latest version of phonegap via npm and recently upgraded my iPhone SE to iOS 10. Now, when I run “connectgap run ios”, when my device is connected via USB cable to my iMac, the load application, I get a debug message from the function app.bindEvents, but the deviceready event does not fire. That is, until my application loses focus (by double-clicking the home button), at this moment my warning about debugging in onDeviceReady is triggered.

I assumed that this had something to do with my application, so I removed all third-party plugins and all the extra javascript, but it still happened. Therefore, I created a completely new application that sets the default Phonegap page to "Connect to a device ..." by default and even does it, although I did not modify it in any way. Again, when the application loses focus, I get the message "The device is ready."

Does anyone have any idea why this might happen?

+5
source share
1 answer

This entry has permission: The Cordoba application hangs during launch on iOS 10 (beta)

Quote:

It seems that iOS 10 requires additional entries in the Content-Security-Policy meta tag, namely gap: // ready and file :. After adding them, my Content-Security-Policy looks like this:

<meta http-equiv="Content-Security-Policy" content="default-src * gap://ready file:; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src * 'unsafe-inline' 'unsafe-eval'">

So just change the meta tag above in the index.html file and the deviceready event will occur.

+7
source

Source: https://habr.com/ru/post/1257362/


All Articles