This is a migrated thread and some comments may be shown as answers.

Trouble getting simple cordova plugin working

5 Answers 310 Views
AppBuilder extension for Visual Studio
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ray
Top achievements
Rank 1
Ray asked on 12 May 2014, 11:53 PM
Title says it all.  I'm following this tutorial:

 http://blogs.telerik.com/appbuilder/posts/13-10-10/using-custom-cordova-plugins-with-the-icenium-extension-for-visual-studio?utm_content=buffer5f6a8&utm_source=buffer&utm_medium=twitter&utm_campaign=Buffer

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.

5 Answers, 1 is accepted

Sort by
0
Ray
Top achievements
Rank 1
answered on 14 May 2014, 03:49 PM
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?
0
Iva Koevska
Telerik team
answered on 15 May 2014, 10:34 AM
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!

Regards,
Iva Koevska
Telerik
 

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

 
0
Ray
Top achievements
Rank 1
answered on 15 May 2014, 08:54 PM
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\SupportPluginTest.zip]
Project files uploaded to the cloud.
Sending build request for project SupportPluginTest with parameters ProjectTypeGuids={070BCB52-5A75-4F8C-A973-144AF0EAFCC9}
AppIdentifier=com.telerik.SupportPluginTest
ProjectName=SupportPluginTest
ProjectGuid=1c234e7c-540a-4c4d-bffa-987c48df708b
Platform=Android
MobileProvisionIdentifier=
iOSCodesigningIdentity=
AndroidCodesigningIdentity=
Configuration=Debug
FrameworkVersion=3.2.0
CorePlugins=org.apache.cordova.battery-status;org.apache.cordova.camera;org.apache.cordova.console;org.apache.cordova.contacts;org.apache.cordova.device;org.apache.cordova.device-motion;org.apache.cordova.device-orientation;org.apache.cordova.dialogs;org.apache.cordova.file;org.apache.cordova.file-transfer;org.apache.cordova.geolocation;org.apache.cordova.globalization;org.apache.cordova.inappbrowser;org.apache.cordova.media;org.apache.cordova.media-capture;org.apache.cordova.network-information;org.apache.cordova.splashscreen;org.apache.cordova.statusbar;org.apache.cordova.vibration
AndroidPermissions=android.permission.CAMERA;android.permission.VIBRATE;android.permission.ACCESS_COARSE_LOCATION;android.permission.ACCESS_FINE_LOCATION;android.permission.ACCESS_LOCATION_EXTRA_COMMANDS;android.permission.READ_PHONE_STATE;android.permission.INTERNET;android.permission.RECEIVE_SMS;android.permission.RECORD_AUDIO;android.permission.MODIFY_AUDIO_SETTINGS;android.permission.READ_CONTACTS;android.permission.WRITE_CONTACTS;android.permission.WRITE_EXTERNAL_STORAGE;android.permission.ACCESS_NETWORK_STATE;android.permission.ACCOUNT_MANAGER;android.permission.GET_ACCOUNTS;android.permission.MANAGE_ACCOUNTS;android.permission.BROADCAST_STICKY
DeviceOrientations=Portrait;Landscape
iOSStatusBarStyle=Default
AndroidHardwareAcceleration=false
iOSDeviceFamily=
BundleVersion=1.0
iOSDisplayName=
AndroidVersionCode=
iOSBackgroundMode=
WP8Capabilities=
WP8Requirements=
WP8SupportedResolutions=ID_RESOLUTION_WVGA;ID_RESOLUTION_WXGA;ID_RESOLUTION_HD720P
WP8TileTitle=
DisplayName=
WP8ProductID=
WP8PublisherID=
WP8Publisher=
Author=
Description=
LiveSyncToken=0AO+xES5PDbK4MdX2TMwnIeF9kvBoPhlbm5tIAWBt2Rhdud92GPKRKJKwzr1uIF47c7jlPWGfkKIGDTF1HicGmbSNYgGgJ8P7TvBvoh9lBCk/V8roTQamLIFGkiS7NGZhgJiL7JK0USt1bpupAHIQg==.
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.
----------------------------------------------------------------------------------------------------------------------------------------

-Thanks
















0
Iva Koevska
Telerik team
answered on 16 May 2014, 08:56 AM
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.

Regards,
Iva Koevska
Telerik
 

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

 
0
Ray
Top achievements
Rank 1
answered on 16 May 2014, 02:49 PM
Ah.  very nice.  Works great now.  Thanks!
Tags
AppBuilder extension for Visual Studio
Asked by
Ray
Top achievements
Rank 1
Answers by
Ray
Top achievements
Rank 1
Iva Koevska
Telerik team
Share this question
or