cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filip Maj (JIRA)" <>
Subject [jira] [Commented] (CB-9661) Plugins should be notified after deviceready event has been fired
Date Fri, 14 Jul 2017 22:23:01 GMT


Filip Maj commented on CB-9661:

As a workaround: what about having the plugin javascript wait for the deviceready event in
JS land, and then send a message back to native using the regular {{cordova.exec}} channel?

> Plugins should be notified after deviceready event has been fired
> -----------------------------------------------------------------
>                 Key: CB-9661
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: AllPlugins
>    Affects Versions: 5.1.1
>            Reporter: Sebastien Lorber
> I use the Intercom plugin.
> It is a plugin that shows a little button at the bottom (that we'll call "widget") that
permits to show a native chat panel when the user wants to give a feedback for our app.
> On startup I run something akin to:
> {code}
> function deviceReady() {
>     hideSplashScreen();
>     if ( isUserConnected() ) {
>         intercom.registerIdentifiedUser(userIntercomData);
>         startApp();
>     } 
>     else {
>         intercom.reset();
>         showLoginForm();
>     }
> }
> {code}
> The widget is only shawn after calling intercom.registerIdentifiedUser();
> The widget disappear when we call intercom.reset();
> The intercom plugin memoizes the fact that an user is registered over time.
> This means that if I kill the app with a registered user, and restart it, Intercom will
by default restore that regitered user on next startup.
> Unfortunatly, this means that the widget will be shawn at the very beginning of the app
initialization, even before the webview is initialized. In my case, it means that the Intercom
button will be shawn for a little amount of time above the splash screen, which is a bit weird.
> This would make sense for the Intercom team to not show the widget until the webview
is initialized, particularly waiting for deviceready event to fire.
> After discussing with the Intercom team, it seems they can't implement this because there's
no possible way to wait for the deviceready event to fire from the native plugin code.
> So I think it could be nice to be able, from the native plugin code, to wait for the
deviceready event to be handled, so that native code can be started afterwards.
> The original plugin issue:

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message