-
Notifications
You must be signed in to change notification settings - Fork 532
Event is not dispatched on the cold start #3
Comments
Actually |
With pleasure :) |
I still have this problem. I have a long index.html (old app) and have tried to add the event listener direct in a script part in the page and also in the onLoad event. In both cases the UL link event is fired when the app is already loaded in the background. When i kill it and try again, the app opens, but without the event. |
Can you show some code, how you do the subscription and where? |
I have made some tests. As i wrote, it is an old and big app. It has one big index.html. I include the cordova.ja and 33 other scripts at the beginning. After that i had this code:
It has not worked, when the app was not running in the background. Now i have moved the UL block between the include of cordova.js and the other scripts.
And this works. |
So now it's fine? |
Yes. I have now the event in front before loading other scripts. Is it possible that the event is fired before the page is loaded? Maybe you should add some information, when the event is called. In my tests i see it before resume and before deviceReady. |
When app is launched from the link - event is saved until plugins JS module is initialised. And this can happen before the As a workaround I can add to the plugin JS module (i.e., function onDeviceReady() {
console.log('deviceready');
// set handler for the event
universalLinks.on('event_name', onULOpen);
};
function onULOpen(event) {
// handle the event
} Internally, it will store the events, received from the native side; and then What do you think about that? |
This would be a good solution, because in the event all cordova stuff is available, when it is called after deviceReady. PS: Thank you for your work. |
Thanks) Closing this issue. Created a separate one with the required feature. |
backwards compatibility for AndroidManifest.xml changes
If you launch the application first from the app icon, close it (by pressing home button on the phone) and then click on the UL link - JS event is captured.
But if you kill the app from task manager, and then click on the link - event is missed.
The text was updated successfully, but these errors were encountered: