Current filter:
                                You should refresh the page.
                                  • I would like to add a PhoneGap plug-in for Android to my DevExtreme project. How can I do it?

                                1 Solution

                                Creation Date Importance Sort by

                                [Updated by Uriah (DevExpress Support)]
                                Starting from version 14.2, we suggest using the built-in feature to include PhoneGap plug-ins into a DevExtreme application. This feature is described in our online documentation: Set Required Plugins.

                                See also:
                                How to modify PhoneGap plugin source code




                                [Old content]
                                There are three ways to add a plugin to your project:
                                I. Following recommendations from Prepare Zip for PhoneGap Build.

                                II. Modifying the config.xml file in Zip for the PhoneGap Build service.
                                The following steps are required:

                                1. Prepare Zip for PhoneGap Build. Please see Prepare Zip for PhoneGap Build.

                                2. Open the config.xml file in your archive and add references for the required plugin. For example, you wish to add the DatePicker plugin. In this case, your config.xml should be modified in the following manner:

                                 

                                [XML]
                                <?xml version="1.0" encoding="UTF-8"?> <widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" ...> ... <gap:plugin value="com.dileep.plugins.datepicker" /> </widget>

                                3. Save config.xml in your archive and use PhoneGap Build for building a native package. The full list of plugins can be found here.

                                III. Using a custom template. You can use this approach for Cordova 2.9.0. Starting with DevExtreme 14.1, please use the approach from one previous sections.

                                It is possible to accomplish this task using the Eclipse IDE.

                                Please perform the following steps:
                                1. Download and install Android SDK.
                                2. Open the Eclipse IDE.
                                3. Click the File -> Import... menu item.

                                4. In the Import window, select the Projects from Git item and click the Next button.

                                5. In the Import projects from Git window, select the URI item and click the Next button.

                                6. Click the DevExtreme-ApplicationTemplate-Android on GitHub.

                                7. Click the Git Read-Only button and then click the copy to clipboard button.

                                8. Paste URL to the URI field and click the Next button.

                                9. Follow the recommendations of the wizard.

                                10. In the Cloning from... window, click the Finish button.

                                If you get the Android requires compiler compliance level ... error in the console, right-mouse click your project in the Package Explorer window and click the Android Tools -> Fix Project Properties menu item.

                                Now your project is ready for adding a required plug-in. Let's add the DatePicker plug-in. Follow the recommendations from the readme.md file to adjust your project structure. When all the modifications are complete, save your project.

                                11. Click the File -> Export menu item.

                                12. In the Export window, select the Export Android Application item and click the Next button. Follow the recommendations of the wizard.

                                13. In the Keystore selection section, specify a corresponding key store and click the Next button.

                                14. In the Key Creation section, specify fields that are shown in the image below and click the Next button.

                                15. In the Destination and key/certificate checks, specify a location where you want to save your APK file and click the Finish button.

                                Now your package is built and you can use as an application template in Visual Studio. See the How to add a custom template to a DevExtreme application article to learn more.

                                In the attachment you will find a project that was created in the Eclipse IDE using the approach described above and a project that was created in Visual Studio using the template from the Eclipse IDE.

                                See Also:
                                Manually install Device plugin (and others) into cordova 3.0
                                How to add PhoneGap plug-in for iOS to a DevExtreme project

                                • David Vielhuber 11.27.2014

                                  Is way III. also possible today with a current version of Cordova / DevExtreme?

                                  The background of my question is how I am able to add
                                  a plugin that is not listed at https://build.phonegap.com/plugins to my project.

                                  There are hundreds of plugins out there and all show in their github docs commands like

                                  cordova plugin add ...
                                  or
                                  phonegap local plugin add ...

                                  Thank you for your support!

                                • Nikolai (DevExpress Support) 11.27.2014
                                  Hi David,

                                  We do not recommend following recommendations from the third section. Please add a plugin to the Plugin list as described in the Prepare Zip for PhoneGap Build help topic, prepare a ZIP archive and build a package using the PhoneGap Build.
                                • David Vielhuber 11.27.2014

                                  This means: I cannot add a plugin that is not listed at https://build.phonegap.com/plugins to my DX project?

                                • Nikolai (DevExpress Support) 11.27.2014
                                  David,

                                  Please accept my apologies for not being clear. The first and the second sections are intended for plugins from the PhoneGap plugin list. You can manually add your own plugin or a plugin that is not in the list to the DevExtreme-14.1-ApplicationTemplate. Build this template by following recommendations from the third section or using the The Command-Line Interface. Then, use the built package as a custom template in a DevExtreme project. 

                                  The third section was written at the moment when Cordova 2.9.0 was released. I do not suggest that you strictly follow the recommendations from it, because each plugin has its own specifics and can be added to the project by following recommendations from its detailed description.