Reputation: 917
I wanted to know how Worklight uses PhoneGap as it's something I am required to do shortly. I hear that PhoneGap is 'build into' Worklight. If this is so, do I have to declare I'm using it, as in the below?:
<script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
And for that matter, if I do have to declare it, how do I know what version of PhoneGap it is utilising? If I don't have to declare it, will it just recognise my PhoneGap calls?
Any advice on this would be super as I just cannot find the answers on either the Worklight or PhoneGap websites.
Thanks!
Upvotes: 0
Views: 1618
Reputation: 1058
Just to update, The newest version on IBM Worklight is PhoneGap 2.2. It just happened this month (Dec 2012). When you write your code, it will auto fill (on default prefs).
For example typing navigator.noti....will popup with the notification options for the alert and confirmation calls and its parameters (with some comments).
Upvotes: 1
Reputation: 1736
@creights there is not need to add Cordova.js internal into your Worklight application. By default Cordova plugin is included in your worklight app. You need to just use the functionality of plugin like camera,accelerator etc for an example i have a piece of code how to include camera in ur worklight application.
function takePicture() {
navigator.camera.getPicture(
function(data) {
var img = dom.byId('camera_image');
img.style.visibility = "visible";
img.style.display = "block";
//img.src = "data:image/jpeg;base64," + data;
img.src = data;
dom.byId('camera_status').innerHTML = "Success";
},
function(e) {
console.log("Error getting picture: " + e);
dom.byId('camera_status').innerHTML = e;
dom.byId('camera_image').style.display = "none";
},
{ quality: 50, destinationType: navigator.camera.DestinationType.FILE_URI, sourceType : navigator.camera.PictureSourceType.CAMERA});
};
Just copy the code into AppMain.js in ur js folder.
Upvotes: 2
Reputation: 3166
Latest Worklight have a Cordova (formerly known as PhoneGap) 1.6.1 It's embedded automatically once you build your iOS/Android application, so you really do not need to add it's JS manually. All of your Cordova calls will be recognized.
Upvotes: 3