How to load a remote page into a cordova Android app and able to access cordova plugins

I use Ionic Framework to develop a mobile app. This project needs loads a page (JavaScript application) into its main webView from a remote server, but also maintain access to the cordova/phonegap plugins. After many test, i finally make it works.

Here is the solution

Edit config.xml

<access origin="*" />
<content src="your_remote_page_url" />

Running to build

cordova build android

Copying cordova.js, cordova_plugins.js files, the plugins and lib directory to the remote server from the cordova projects platforms\android\assets\www direcory
Add following scripts in page on the remote server:

<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/ngCordova/ng-cordova.js"></script>
<script src="cordova.js" type="text/javascript"></script> 

That’s all. 🙂

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

Comments are closed.