开发者

GWT-PhoneGap always timeout

开发者 https://www.devze.com 2023-02-01 11:14 出处:网络
I\'ve been trying to setup gwt-phonegap in my project, but keep getting timeout, saying that phonegap was not loaded (the handler of timeout is called)

I've been trying to setup gwt-phonegap in my project,

but keep getting timeout, saying that phonegap was not loaded (the handler of timeout is called)

i'm compiling the project with GWT,开发者_高级运维 copying the entire war directory over to the phonegap www directory, remove the old index.html and rename my project's main html to index.html

the page than loads, showing the background image, but moments later get the timeout

what am i doing wrong?

code:

public class GWTphonegapExample1 implements EntryPoint {
    /**
     * This is the entry point method.
     */
    public void onModuleLoad() {
        GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
            @Override
            public void onUncaughtException(Throwable e) {
                Window.alert("uncaught: " + e.getLocalizedMessage());
            }
        });

        final PhoneGap phoneGap = new PhoneGap();

        phoneGap.addHandler(new PhoneGapAvailableHandler() {
            @Override   
            public void onPhoneGapAvailable(PhoneGapAvailableEvent event) {
                RootPanel.get().add(new FlowPanel());
            }
        });

        phoneGap.addHandler(new PhoneGapTimeoutHandler() {
            @Override       
            public void onPhoneGapTimeout(PhoneGapTimeoutEvent event) {
                Window.alert("can not load phonegap");
            }
        });

        phoneGap.initializePhoneGap();
    }
}


i hate to solve my own questions,
but after hours of searching, i came to realize that i did need to include the phonegap.js in the gwt html...
so that solved it adding this:
< script type="text/javascript" charset="utf-8" src="phonegap.js">
to the html is the solution

0

精彩评论

暂无评论...
验证码 换一张
取 消