How to add cordova plugin in IOS cordva application? - ios

i have cordova application in IOS.I am using x code to modifying in application. actually i am new to mac and IOS i want to know how to add custom or third party cordova plugin in my IOS application.Any tutorial or guidance any one recommend?

You use cordova, to add plugins you use:
cordova plugin add *pluginname*
in the installation process it will be added to all platforms that the plugin supports. For further information about that you have to read the readme files of the plugin. They explain that for every part of their plugins better than we can here in our short texts.
If you have any further question, just ask :) Have a nice day.

You can use the command cordova plugin add PLUGIN_NAME
Please check the documentation from Cordova for other options to update, remove, build the plugin https://cordova.apache.org/docs/en/3.1.0/guide/cli/index.html

Related

How to write custom / own plugin for ionic framework

Im trying to write own plugin to call native iOS functions. Can any one guide me in writing own plugin & consume it to my ionic application.
Thanks in advance
It can be done using Cordova's Plugin Development Guide.
from docs it says,
Plugins comprise a single JavaScript interface along with
corresponding native code libraries for each supported platform. In
essence this hides the various native code implementations behind a
common JavaScript interface.
you can check these articles for kick-start.
Plugin Development Guide
How to write Cordova Plugins
Tutorial

IOS Phonegap 3.X: Lock page orientation during runtime

I am developing a webapp using phonegap + sencha touch, and I want to lock orientation on certain pages during runtime. I found this phonegap plugin , but it's not working for phonegap 3.X.
I also found something about a js function which named 'shouldRotateToOrientation', is it provided by phonegap? And it seems just works in multi-page(html files) app, my sencha touch app only have one html file.
So, how can I do that? Any help from you will be greatly appreciated.
i know this is not really a valid "answer" but SO doesn't let me comment with <50 rep. anyway, i noticed it's not that difficult to set up an old plugin to be used with cordova 3+. adhere to the folder structure (which you can see in existing cordova plugins like "device"), create a plugin.xml and install the plugin with plugman. read the documentation about plugin development and you should be good.
you will especially have to replace the function header in the ios files. replace
-(void)setAllowed:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
with
- (void)setAllowed:(CDVInvokedUrlCommand*)command
This is a phonegap plugin for android/ios.
https://github.com/yoik/cordova-yoik-screenorientation

PhoneGap 3.3 HideKeyboardFormAccessoryBar not working

I am using PhoneGap 3.3.0-0.19.6 and Cordova 3.3.1-0.4.2 but HideKeyboardFormAccessoryBar=true doesn't work. I checked other related questions and the solution (at least for PhoneGap 2.7) is to edit CDViewController.m (under Classes/Cleaver), but apparently this file is missing in Phonegap 3.3
Please help!
I use KeyBoard plugin to fix this problem. (I'm currently in phonegap 3.4.0)
To download it, either
Type 'cordova plugin add https://github.com/apache/cordova-plugins.git#dev:keyboard' in your project folder
Or type 'phonegap local plugin add org.apache.cordova.keyboard', and update the newest code from KeyBoard plugin.
For Further infomation, visit phonegap CB-3020 jira. (sorry, I not allow to post more than 2 links)
Good Luck!

Phonegap 3.0 PowerManagement

Is it possible to use the PowerManagement Phonegap Plugin found here https://build.phonegap.com/plugins/29 with Phonegap 3.0 on iOS6,7?
If so, is it still enough to place the following element to the config.xml?
<gap:plugin name="com.simplec.plugins.powermanagement" />
Or is there a way to install it the Phonegap 3.0 way messes up the iOS version of the app:
phonegap local plugin add https://github.com/simplec-dev/powermanagement.git
What I want to achive is, that my app runs endless and the iPhone power saver gets suppressed.
Thanks for a hint.
I'm not sure if the original author has updated the plugin to be compatible with PhoneGap 3.0 yet - but I maintain a fork of it that I have updated that should work. It lives here but you should be able to install from the CLI like this:
$ cordova plugins add https://github.com/cemerson/cordova-powermanagement.git
Also, I'm not sure how recently you've used the plugin but the syntax/usage has changed over the past months/year. I have a few helper scripts that I normally use here if you want to modify/use.
PS: Naturally if the original author has updated the plugin somewhere to be 3.0 compliant definitely use that version! Use the above only if that's not the case or you have other problems!
Cordova plugin PowerManagament for 3.0+
https://github.com/raulduran/PowerManagement

UserVoice integration in an Phonegap application

I have this iOS Phonegap application and I need to integrate UserVoice. I follow this tutorial and I have reached to the point I have to make the configuration. I am really not sure where I have to put that object UserVoice are providing me with:
UVConfig *config = [UVConfig configWithSite:#"YOUR_USERVOICE_URL"
andKey:#"YOUR_KEY"
andSecret:#"YOUR_SECRET",
andSSOToken:#"SOME_BIG_LONG_SSO_TOKEN"];
I'll appreciate some help with that, since I'm really on a beginner level with iOS apps in general. Thanks in advance.
The code you posted comes from the UserVoice for iOS SDK which gives you the libraries and code necessary to include UserVoice in a native iOS app and will not work with a PhoneGap app.
Your options are to write a PhoneGap plugin, in Obj-C, to expose the UserVoice library, or possibly a better option is simply to open your UserVoice page within your PhoneGap app using the InAppBrowser plugin.
Here is a simple phonegap plugin
http://developerextensions.com/index.php/cordova-phonegap-plugin-uservoice
I took the code from here: http://developerextensions.com/index.php/cordova-phonegap-plugin-uservoice and followed their instructions.
There were some additional things I needed to do:
edit the config.xml and add the feature UserVoiceCommand
edit the .js file and replace Ext.emptyFn with function(){}:
cordova.exec(function(){}, function(){}, "UserVoiceCommand", "launch", [config]);
(those are the success and failure callback, which I intend to implement as well)
Since it was not functioning correctly on iOS7, I cloned https://github.com/uservoice/uservoice-ios-sdk, compiled it by running ./build.sh and then overwritten the files that came with the plugin.
You can now get iOS+Android support from this new cordova plugin:
https://github.com/Resgrid/cordova-plugins-uservoice
P.S. I am not affiliated to this plugin by any means, just came across it.

Resources