Thursday, 24 October 2013

Installing plugins in Phonegap 3.0

Check whether the plugin supports Phonegap CLI, or not,
-          If it does,  run the command.
Using the Phonegap CLI run:
Ø p  phonegap local plugin add https://github.com/aharris88/phonegap-sms-plugin.git
This will place the plugin in your plugins directory and update your android.json file that keeps track of installed plugins.
Then when you run:
Ø     phonegap  build android
or phonegap install android
phonegap will put the necessary files into the platforms/android directory. It will update AndroidManifest.xml, res/xml/config.xml, and it will add the src/org/apache/cordova/sms directory.

-         If it doesn’t,

-   Copy the .js file to your 'www' folder. And link it to your html.

-   Create a package, create the folder structure as yours package name.
                        com>Nuevalgo>plugin>

-   Copy the .java file into this package.
-   Update your platforms\android\res\xml\config.xml adding the following line.



The plugin will be added to your project. Once these things are done, all you have to do implement the js functionality in your app, as you need it.

To view the errors while building:

Add verbose argument to the build command as follow.
-  phonegap -V build android


If you’re getting a class not found exception, check the config.xml where you added your plugin. The package name might be not correct.

No comments:

Post a Comment