jcdmb
jcdmb

Reputation: 3056

PhoneGap on Android: Loading a WebApp from a remote server

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.

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?

Upvotes: 7

Views: 6312

Answers (1)

Gajotres
Gajotres

Reputation: 57309

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

Phonegap + Android :

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

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

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

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

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

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

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

Upvotes: 6

Related Questions