PhoneGap的Andr​​oid上:从远程服务器加载Web应用程序

问题描述:

我的Andr​​oid PhoneGap的应用程序的工作completelly时,我所有的网页文件(HTML,JS,CSS ...)复制到项目的www文件夹如预期,并编译与这些文件的应用程序。但是,当我不复制它们,并重定向到包含这些文件我的Web服务器(即在WWW文件夹中只有一个文件:index.html的一个重定向到我的服务器)的PhoneGap没有在应用程序中工作了。

My Android PhoneGap application works completelly as expected when I copy all the web files (html, JS, CSS...) to the www folder of the project, and compile the application with these files. But when I do not copy them, and make a redirection to my Web Server containing these files (i.e. in the WWW folder there is only one file: index.html with a redirection to my server) phonegap does not work in the application anymore.

有没有办法让PhoneGap的工作,当应用程序内容文件由远程服务器下发,而不是与应用程序编译的?

Is there a way to get phonegap to work, when the application content files are delivered by a remote server and not compiled with the application?

这是可以做到。没有什么能prevent你这样做。

It can be done. Nothing can prevent you from doing that.

PhoneGap的+ Android的:

Phonegap + Android :

在您的主要活动类,方法的onCreate改变使用loadURL为:

In your main activity class, method onCreate change loadUrl to:

super.loadUrl(HTTP://.../index.html);

super.loadUrl("http://.../index.html");

iPhone + PhoneGap的保险业监督另一个故事,仍然是可以做到的。因为有很多的变化,这里是一个教程:http://www.joeldare.com/wiki/open_a_url_in_phonegap

iPhone + Phonegap ia another story, still it can be done. Because there's a lot of changes here's a tutorial: http://www.joeldare.com/wiki/open_a_url_in_phonegap

还有一件事,您必须启用PhoneGap的互联网连接。

One more thing, you must enable internet connection for Phonegap.

由于您使用的是Android平台这条线添加到您的Andr​​oidManifest:

As you are using the android platform add this line to your AndroidManifest:

<uses-permission android:name="android.permission.INTERNET" />

嗯,还有一件事,一个视meta标签必须在HTML文件中设置。

Ah, one more thing, a viewport meta tag must be set in your html file.