Answered: Handling deviceready in controller

Hi,
When I need to use a cordova plugin, I listen for the deviceready event.
In all examples I have seen so far, the event and its handler are registered in app.js' launch function.
Is there a way to put the handler in a controller so that I can use the plugin from the controller?
Basically I want my controller to be notified/launch function called when the deviceready event fires.

This is correct. We detect if you are within a Cordova/PhoneGap app and then add a deviceready listener. The application's launch method (and therefore the controllers' launch methods) will not execute until the deviceready event has already been fired.

This is correct. We detect if you are within a Cordova/PhoneGap app and then add a deviceready listener. The application's launch method (and therefore the controllers' launch methods) will not execute until the deviceready event has already been fired.

This is because deviceready fires immediately if cordova is already ready. It's a nice feature that lets you add deviceready handlers that will fire even if cordova is already completed.

Does this also apply to ExtJS Modern....? I don't see that working. I need to check orientation and safe inset in mobile device.

When I try to access device API (cordova orientation plugin) from Launch method, it is usually not ready (hit and miss)
On Device ready is ALWAYS called after Launch, and then the plugin is ALWAYS ready (as opposed to checking it in Launch method).

So either it is messed up in Modern, or it never worked there (so that application / viewport launch does not wait for device ready event).