IOS Phonegap 3.X: Lock page orientation during runtime - ios

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

Related

How to add cordova plugin in IOS cordva application?

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

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

Disable orientation change for only specific page

I am developing an application with jquerymobile. I want to disable my landscape orientation for only main page not for others. Are there any commands to do this for pages separately instead of manifest file?
For Android, you can use this screen orientation Phonegap plugin in your main page. I've updated the code to be compatible with Phonegap 2.8.0 - you can find the source code in my answer to this question as well my Eclipse project and resulting APK.
There's an equivalent iOS plugin here but I haven't used it and it may need updating for use with the most recent versions of Phonegap.

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.

IOS - Phonegap - barcodescanner

I'm trying to make an app which uses the barcodescanner plugin for IOS which comes with the phonegap plugin library (latest build / phonegap 1.4). I have allready made the Android version with the same plugin for android, and it worked fine. I have followed the instructions step by step and it won't work for me.
I'm getting an com.phonegap.barcodeScanner not found, and i have checked that the plist is correct etc.
I have copied the new scanneroverlay.xib to the project so i don't have to play with the overlay.
I have copied all the mm c h files to the plugin folder. No error when building. Does i have to compile the plugin or??? is there someone who has a test app or a good idea please.
Getting a little frustrated.
Kind regards.
/Mikael
Check that you have a reference to the barcodescanner.js in the index.html file, and that it is finding it okay.

Resources