Calling Phonegap Javascript

I’m trying to do something that should be very simple… calling a PhoneGap/Cordova function from Vaadin 7.

I want the app splash screen to stay up until the Vaadin app has loaded from the server (otherwise the user is faced with several seconds of a blank white screen).

In my PhoneGap Build config.xml, I enable the splashscreen controls and disable auto-hide:

    <gap:plugin name="org.apache.cordova.splashscreen" />
    <feature name="SplashScreen">
        <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
        <param name="onload" value="true" />
    </feature>
    <feature name="SplashScreen">
        <param name="ios-package" value="CDVSplashScreen" />
        <param name="onload" value="true" />
    </feature>
    <!-- iOS: if set to false, the splash screen must be hidden using a JavaScript API -->
    <preference name="AutoHideSplashScreen" value="false" />
    <!-- Android: The amount of time the splash screen image displays (if not hidden by app) -->
    <preference name="SplashScreenDelay" value="10000"/>

(Auto hide is no good because it hides when the native app has started, but before loading everything from the server.)

Then in my app’s UI.init() method, I call:

if (getPage().getWebBrowser().isAndroid() || getPage().getWebBrowser().isIOS())
getPage().getJavaScript().execute("navigator.splashscreen.hide();");

This doesn’t appear to do anything… the splash screen stays up forever on iOS and goes away after the full timeout on Android.

How do I call Javascript? Do I need an extension to call it? Use gwt-phonegap; and if so how to call it?

The Vaadin-PhoneGap add-on is based on an outdated version, has a broken source code link, and only supports cameras.

This forum has many threads of people saying “You can use PhoneGap”, but little from people actually doing it. I expect a long pause looking at a blank screen will get my app to fail the Apple app store review process.

Stil can’t get PhoneGap plugins to work, but worked around the problem by putting content in the PhoneGap index.html that shows an “Initializing” message, and also times out to show a retry link if the forward to the server fails. (That only works on iOS though; Android shows it’s own ugly error message and retry link.)

I’m having the same problem. Did you get it working?