2 Replies Latest reply on Apr 6, 2016 12:25 AM by michealh82750922

    Phonegap Desktop - Using Plugins

    michealh82750922

      Hi Newbie question here. I downloaded and installed phonegap desktop, I have created a phonegap project that i have ran on the the emulator app on my phone.

       

       

      I am trying to get the network information plugin and the media plugin for sound working.

      I want to test if i have an internet connectino and i want to play sound on the app.

       

       

      My question is in regards to plugins. I seem to find all different kinds of documentation as how to use plugins and im not sure what to do.?

       

       

      some sites have different plugins that were downloaded and put into folders, others just added them into the config.xml but those lines already seemed to be there, and i wasnt having much luck getting them working.

       

       

      also when i am happy with this app what steps do i have to go through to build it into a fully functional app from there?

       

       

      I know this is a newb question but im really getting bogged down searching for something that is probably simple, thanks in advance

        • 1. Re: Phonegap Desktop - Using Plugins
          kerrishotts Adobe Community Professional

          Hi! Answers inline.

          Hi Newbie question here. I downloaded and installed phonegap desktop, I have created a phonegap project that i have ran on the the emulator app on my phone.

           

           

          I am trying to get the network information plugin and the media plugin for sound working.

          I want to test if i have an internet connectino and i want to play sound on the app.

           

          Please note that the PG Developer App isn't a perfect emulation of the environment a compiled app will receive. It's really cool and good to use for rapid iteration, but there are cases where you'll run into differences. The media plugin is one of them -- in a compiled app, your sound may be in the app's bundle, but this will break in the PG Dev App because the bundle refers to the PG Dev app, not /your/ app. The network information plugin, OTH, should work without differences (AFAIK).

           

          My question is in regards to plugins. I seem to find all different kinds of documentation as how to use plugins and im not sure what to do.?

           

           

          some sites have different plugins that were downloaded and put into folders, others just added them into the config.xml but those lines already seemed to be there, and i wasnt having much luck getting them working.

          Plugin infrastructure and instructions for adding them to your project have changed over the years and so docs have evolved along those lines. Many docs still continue to include manual installation instructions as well. Generally, if the docs say they are compatible with the PG/Cordova CLIs, use the "cordova plugin add" command they provide. Plugins that can be installed this way will provide a "plugin.xml" file in their repo.


          Keep in mind, however, that when using the PhoneGap Developer App, you only have access to the core plugins plus a few additional plugins. That means if the plugin isn't compiled into the PG Dev App, you can't use it, regardless of what's in your config.xml (PG Dev App does NOT parse config.xml). You can either:

           

          • Build a version of the PG Dev App for your own use that includes the plugins you intend to use
          • Install PhoneGap / Cordova CLIs and build your app directly
          • Build your app using PhoneGap Build

           

          When using the CLIs, you add a plugin like this:

           

          cordova plugin add cordova-plugin-some-plugin-id --save
          

           

          The --save switch will update your config.xml file appropriately to include the plugin. I suggest making sure that you also pin your plugins to a specific version so you don't accidentally pull a newer version later and break your code unexpectedly.

           

          When using PGB, you will just add a plugin to config.xml, like

           

          <plugin name="cordova-plugin-some-plugin-id" spec"x.y.z" />
          

           

          Finally, if you are trying to use a core plugin and it isn't working, please be more specific so that we can help. Include error messages, code snippets, etc.

          also when i am happy with this app what steps do i have to go through to build it into a fully functional app from there?

          You will need to build your app using either the PhoneGap / Cordova CLIs or PhoneGap Build.

          I know this is a newb question but im really getting bogged down searching for something that is probably simple, thanks in advance

          When in doubt, look at the docs:

           

          And if that fails, give us a holler!

          • 2. Re: Phonegap Desktop - Using Plugins
            michealh82750922 Level 1

            kerrishotts , wow, that has to be one of the best and clear explanations so far of how to do what I'm looking for.

            Thank you very much.