Trouble getting simple cordova plugin working

Thread is closed for posting
6 posts, 0 answers
  1. Ray
    Ray avatar
    9 posts
    Member since:
    Mar 2014

    Posted 12 May 2014 Link to this post

    Title says it all.  I'm following this tutorial:

    I can run it but when I click the share button nothing happens.  I'm having troubles debugging this because apparently plugin's only work once you run the device on your phone.  ( maybe there's some tricks to debug on your local device I don't know about).

    visual studio 2013 with appbuilder extension.  I'm attempting on an htc evo 4g lte and also on the iphone 5s with no luck...

    any help would be great.
  2. Ray
    Ray avatar
    9 posts
    Member since:
    Mar 2014

    Posted 14 May 2014 in reply to Ray Link to this post

    perhaps it isn't possible to add third party cordova plugins(plugman compatable) while using appbuilder extensions for VS(on VS 2013)?  Is there a bug in VS 2013 extensions?
  3. Iva Koevska
    Iva Koevska avatar
    286 posts

    Posted 15 May 2014 Link to this post

    Hello Ray,

    Thank you for reporting your issues with custom plugins and the extension for Visual Studio.

    I have reviewed and followed the blog post and have been able to create the desired app with a few tweaks to the code and the procedure. Please, note, that this post has been published a while back and is very outdated as of this moment. Unfortunately, we do not have the policy to go back and edit already published content. For a reference on how to use the latest features, your best bet would be to use the latest blogposts and visit our documentation here.

    Please, find attached the actual app.js that will work and follow these basic workflow (based around the blogpost) to get the app running.
    1. Create a new Kendo UI Mobile projects (as per the blogpost).
    2. Replace scripts\app.js with the provided file.
    3. Replace the contents of index.html with the ones from the blogpost.
    4. Add the custom plugin as per the instructions in the blogpost. Do not add the script reference that the blogpost mentions as it is not necessary. Just add the plugin files.
    It is important to note that in some case, some users have reported that drag and drop on the Plugins folder does not work for them. (Usually this is related to running or not running VS as Administrator, based on your system settings). In this case, right-click on the Plugins folder and use the Add -> New Folder and Add -> Existing Item... commands to add the folders and files one by one. 
    5. Make sure that each file of the custom plugin has the Build Action property set to Content.
    6. Build and deploy your app on device as an application package (not in the companion app, as indicated by the blogpost). It is very important to use the application package option because testing custom plugins does not work in the companion app. You also cannot test custom plugins from the device simulator.

    Let me elaborate on the build and deploy part a bit. You can go two ways - deploy straight to a connected device or deploy wirelessly via QR code. If you want to debug, you will need to deploy on a connected device and make sure that everything in your setup meets the requirements for debugging. Please, follow these instructions to build and deploy via QR code and these instructions to build and deploy via cable connection. Again, I cannot emphasize enough on the fact that you need to deploy as an application package (IPA/APK) rather than in the companion app.

    Detailed instructions on how to debug on device are available here and here.

    A few words about the modified app.js. First of all, every Cordova app needs the deviceready event to fire before anything else happens with your app. This is why I have added a deviceready event listener and a onDeviceReady function. Second, the call of the custom plugin was using an invalid object. This behavior has been modified.

    Let me know if you would like to get a copy of the entire project or if you have any further questions. Good luck!

    Iva Koevska

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

  4. Ray
    Ray avatar
    9 posts
    Member since:
    Mar 2014

    Posted 15 May 2014 in reply to Iva Koevska Link to this post

    Thank you very much, that helped a lot.   I am however another issue deploying to the device.

    When I attempt to build and deploy via QR code I get an error "cannot find application package for Android".  (see screen shot attached).

    I also tried to build and deploy via cable connection and got this in my output window:

    Building package: [c:\users\ray.loveless.klasorem.000\documents\visual studio 2013\Projects\SupportPluginTest\SupportPluginTest\obj\Debug\]
    Project files uploaded to the cloud.
    Sending build request for project SupportPluginTest with parameters ProjectTypeGuids={070BCB52-5A75-4F8C-A973-144AF0EAFCC9}
    C:\Users\ray.loveless.KLASOREM.000\AppData\Local\Microsoft\VisualStudio\12.0\Extensions\fcfwjkff.v1b\Targets\Build.targets(157,3): error : Server build failed. Server output: Project "SupportPluginTest.proj" (default targets):
    Error: ENOENT, no such file or directory '/tmp/76b4e782273e45e79b6b3bf7957861e5/Plugins/src/plugin.xml'

    Done building project "SupportPluginTest.proj" -- FAILED.
    Done building project "SupportPluginTest.iceproj" -- FAILED.

    Build FAILED.


  5. Iva Koevska
    Iva Koevska avatar
    286 posts

    Posted 16 May 2014 Link to this post

    Hello Ray,

    Looking at your screenshot, it appears that you have not added the plugin as per the instructions in the blog. Your current Plugins folder structure is invalid and will cause the build to fail.

    You need a structure that looks like this. Note that there is a middle node under the Plugins folder which contains the src, www, and plugin.xml. I have attached the working sample project with the correct Plugins folder structure so that you can examine it.

    Let me know if you're still having issues.

    Iva Koevska

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

  6. Ray
    Ray avatar
    9 posts
    Member since:
    Mar 2014

    Posted 16 May 2014 in reply to Iva Koevska Link to this post

    Ah.  very nice.  Works great now.  Thanks!
Back to Top