Phonegap plugins not working - javascript

Phonegap plugins not working in Phonegap cordova-1.5.0 in iPhone. I added the plugin for date picker and one anohe plugin for making phonecall.
I used the plugins from
https://github.com/phonegap/phonegap-plugins/tree/master/iPhone.
Any one have any idea about this issue??
I just added the external JS file and called it directly. Do I need to make any changes in the plist or somewhere else. Can anyone tell me the steps to use the Phonegap Plugin in iPhone.?

Make sure that you are using the PhoneGap version that is compatible with the plugin structure (there were changes around 2.0, and Version 1.5 is pretty old). For the latest architecture, check here for details:
http://docs.phonegap.com/en/2.7.0/guide_plugin-development_index.md.html#Plugin%20Development%20Guide
For the older plugin architecture, check here:
http://www.adobe.com/devnet/html5/articles/extending-phonegap-with-native-plugins-for-ios.html
Depending on the version, yes, you may need to edit the .plist files in your Xcode project. You also have to add the native files to the Xcode project, not just the JavaScript.

Related

Cordova cordova.plugins is undefined on win8 but not on iOS

I'm using the plugin fileopener2 and to use it, I must call cordova.plugins.fileopener2.open(...);
When I run this on iOS, everything works perfectly. However, when I run the app on win8, I get an error telling me that cordova.plugins is undefined. Also, I double checked that, after 'ondeviceready' is fired, I console.log the value of cordova.plugins and it indeed returns an undefined value. Can anyone point me as to how I can fix this issue?
For Cordova Windows8 applications (or all applications built with Visual Studio), if your plugin is a custom one (I would assume it's not part of the org.apache...), you have to manually add it. Go to the config file in your www through visual studio. You will see three tabs: Core/Custom/Installed. Go to Custom, go to your cordova project, then in the plugins, find your custom plugin and add the folder of the plugin and voila, it will work!
If you are running into a problem with the plugin not working for a specific platform but working correctly for other platforms, first verify the plugin supports that platform. If the platform is supported, you should contact the plugin author which can generally by done by filing an issue at their GitHub site.
Ex: https://github.com/pwlin/cordova-plugin-file-opener2/issues
Projects created using Visual Studio 2015 are standard Cordova CLI projects. They author may not have Visual Studio, but should be able to reproduce your problem using the command line if you provide them the Cordova version you used (4.3.0 is the default as of VS 2015 RC) and good repro code.

Moving an XPages app from a Domino 8.5.3 to Domino 9.0 - keep Dojo 1.6.1?

Have anyone done this?
I think this could be a major deal breaker if you need to modify all your JS code to work with later versions of Dojo to be able to upgrade your servers.
I have an application that doesn't work, out of the box, on Dojo 1.8x and need to use the same Dojo version as the old Domino 8.5.3 server does (1.6.1).
When I check the JS-catalog only dojo-1.5.2 is available (for some odd reason).
Setting xsp.client.script.dojo.version, in the application, = 1.5.2 will load this version but it seems to be missing everything from XPages - the catalog doesn't contain anything related to XPages, it's missing the ibm-folder.
What do I need to do to make an XPages application use Dojo 1.6.1 on a Domino 9 box, the same way a Domino 8.5.3 box does?
Thanks!
/J
Dojo 1.6.1 was deployed on Domino 8.5 via a plugin. You should be ale to copy that across from a Domino 8.x installation or, if you've upgraded, it may still be there. It should be in \osgi\shared\eclipse\plugins. That's where the file needs adding to R9. It should be com.ibm.xsp.dojo_..., which is the format of the R9 version.
As Paul Stephen Withers write You could try to copy Domino\osgi\shared\eclipse\plugins\com.ibm.xsp.dojo_8.5.3.20120628-0936.jar plugin to R9 and then set the property xsp.client.script.dojo.version to 1.6.1.
But I would advise You to try to run Your app in 1.8 dojo. This version is quite compatible with previous and there should not be much work in porting 1.6 code. Im speaking from experience here - we managed to port quite big app in matter of days.
What I ended up doing was to extract the DOJO 1.6.1 directory from the JAR and manually copying it into the correct directory (use the same naming conventions as the version(s) already installed).

PhoneGap Build Service "Build in HTML5, CSS, JavaScript" claim

The PhoneGap build service says you can build an app in HTML5, CSS, and JavaScript. However, The phonegap.js is not available for each device (latest download PhoneGap 1.8.1 does not have one for Bada or iOS). So I think the build service is meant to save us from creating the shells for each environment, but I fail to see how the PhoneGap API is supposed to work.
I thought the idea too was that you could build one code base for each environment. I know there are quirks, but why is there a separate phonegap.js file for Android, WebOS, etc.?
The lack of documentation has me confused.
In my experience, there are separate files for each but when using phonegap build if you want to include a universal file for the build there is a way, put <script src="phonegap.js"></script> in your index.html file and don't include any js files, you actually don't even need the phonegap.js file, when I did this and ran it through phonegap build it attached the appropriate .js file to the appropriate build and I suddenly could use the phonegap API's for all the builds I was testing
The phonegap framework is made for specific Mobile Operating Systems. The reason why there are so many is because each framework is for each type of operating system. Like for games, most only work for Windows and some for mac, but very little support for Linux based systems. Phonegap creates APIs for using the camera and other functionalities of the operating system.
Phonegap has their tutorials to show you how to install for iOS and Android. I have not developed for newer systems.
Many people use jQueryMobile to develop with PhoneGap to create a nice simple mobile application.
I hope this helps.
Whilst there are different phonegap.js files for each device, they are very similar (I found this out because I accidentally copied it from an iOS project to the Android one a few times). The differences are important but they do pretty-much work as-is.
The main reason they differ is that they just expose the underlying functionality provided by the Phonegap device-native code (Java, OC etc), which IS device-dependent. The Phonegap devs just take care of hiding that from you. All of the phonegap.js files expose the same functionality, they just connect sometimes to different places 'on the inside'. Hence the differences.
Most source 'you or I' would write for a Phonegap app is device-independent as a result of the above.

Android phonegap access jarfile

I'm just getting started using phonegap. I have some implemented libraries (jars) and I want to access them through javascript. I've been looking for an example to do this but I didn't find any. If you know any link or tutorial that would be great.
Here is a tutorial that shows how to use a Barcode Scanner library with a plugin for a PhoneGap app. (Note that it is written for PhoneGap 1.4.1, so you'd have to make appropriate namespace changes if you use a more recent PhoneGap/Cordova version.)

How to build JavaScriptCore for iOS device?

I've downloaded Webkit nightly build. I open JavaScriptCore and built it. Compilation done without any error. But the output was a Framework contains only OS X binary. I tried unchecking 'build active architecture only' but only desktop architectures built. (I looked in the binary with lipo tool)
Is there any simple way to do this? I'm expecting static library can be linked to my iOS app project. I'm trying to embed JSC as in-game script engine.
It looks like there is an XCode project for JavaScriptCore that is part of the WebKit codebase. I was able to change the target SDK to iOS and the target architecture to arm6/arm7, and the dynamic framework built fine. You'll need to compile it to a static library, of course, so you'll need to create a new static library target for iOS and copy everything under Targets->JavaScriptCore into your new static library target. It may be a little tricky, but it might work.
I forked phoboslab's repo and updated it to the latest verson from WebKit (as of last friday). It is compatible with iOS 5 and 6 and includes the Objective-C to Javascript bridge to be featured in iOS 7 (no private frameworks or function used).
You can find the repo on GitHub at:
https://github.com/darionco/JavaScriptCore-iOS
I also added a ZIP file to the repo containing the library (.a) and needed header files for convenience.
Cheers!

Categories

Resources