Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call phonegap plugin function within web app

i am building my first phonegap app and when i open the app i instantly redirecting (window.location) the user to my server where my web app is hosted. Is it possible to load the phonegap plugins from there? Because the "deviceready" event is not firing and i cannot call any plugin functions.

like image 994
user3425512 Avatar asked Mar 25 '26 13:03

user3425512


1 Answers

Short answer: Yes

Some 'gotcha's'

  1. You will have to supply correct cordova.js version for the platform browsing to your site.

    you can look here for more info https://github.com/apache/cordova-js. This project hosts the core js elements, and builds the platform specific cordova.js lib

  2. Any plugin api's your app wants to interact with must be pre-installed into the Native App

    any plugin with native code will have to be added to the project and deployed to device bundled inside the app. There is no way to lazyload native code. The js portions of the plugin could be hosted on your server, however.

More information, some apps that do this

  1. The PhoneGap Developer App uses a similar technique to what is describe above and what you want. The only difference is that it is meant as a dev tool, and the server is a local dev machine.

  2. The Cordova App Harness also uses this technique of pre-bundling an app package with plugins, to be consumed by remotely hosted resources

like image 106
Lorenzo Avatar answered Mar 27 '26 14:03

Lorenzo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!