Reputation:
After researching I've found out that it is indeed possible to build your ionic apps using PhoneGap Build. According to this article there's a few changes one has to do, e.g. changing the location of the config.xml
file as well as specifying your plugins in the config.xml
(something you don't have to do in Ionic). For instance:
<plugin name="org.apache.cordova.camera" spec="0.3.6" source="pgb" />
Normally in Ionic you just have to run
cordova plugin add org.apache.cordova.camera
In the root of your project. Now the question is, after I specify the plugin in the config.xml
file. How does my app know where to look for these dependencies PhoneGap Build injects? Don't I have to somewhere in the project (index.html
perhaps?) reference the library?
Thanks for anyone that can clarify this a bit for me.
Upvotes: 0
Views: 845
Reputation: 147
we build our apps with pgb and use ionic as a framework. It works great. In case the plugin is installed correctly you normally can just reference to the global objects described in the docs of the plugin. For example the camera plugin (https://www.npmjs.com/package/cordova-plugin-camera) just adds a global object to the navigator. You can access the camera function over navigator.camera e.g. navigator.camera.getPicture(...).
In the logs of the pgb build you can check if all the plugins are installed correctly.
PS: PGB moved most of the plugin repos to npm. Just check the plugin over https://www.npmjs.com.
best regards Peter
Upvotes: 0
Reputation: 465
I will show how I used until a little time ago.
I had two projects, one Phonegap project and another Ionic. I was doing all development in the Ionic project. When I needed to test something on the phone, I was using the Phonegap Build.
Both projects have the folder "www". To use Phonegap Build site, I was replacing the folder "www" of Phonegap project with the "www" folder of Ionic project. Then just send the Phonegap project ZIP to Phonegap Build site. This always worked for me.
If you use Phonegap Build site you don´t need to add platforms (cordova platform add
) and don't need add plugins (cordova plugin add
). Just create the Phonegap Project (phonegap create my-app
), set up the config.xml (put plugins) and only replace the "www" folder by the Ionic.
PhoneGap Build's only requirement for your application structure is that the config.xml and index.html is in the top level of your application.
Upvotes: 1