<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-4438803281552454032</atom:id><lastBuildDate>Thu, 24 Oct 2024 06:40:43 +0000</lastBuildDate><title>Sugar Cordova</title><description></description><link>http://sugarcordova.blogspot.com/</link><managingEditor>noreply@blogger.com (Puneet Kaur)</managingEditor><generator>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><language>en-us</language><itunes:explicit>no</itunes:explicit><itunes:subtitle/><itunes:owner><itunes:email>noreply@blogger.com</itunes:email></itunes:owner><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4438803281552454032.post-8817054399639376598</guid><pubDate>Sat, 21 Mar 2015 03:21:00 +0000</pubDate><atom:updated>2015-03-22T12:08:18.628-07:00</atom:updated><title>IMPORTANT INFO FOR GSOC APPPLICANTS APPLYING FOR SUGAR CORDOVA PROJECT</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi,&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I would request all the GSOC 2015 applicants to kindly go through&amp;nbsp;http://plugins.cordova.io/#/ page and find out the plugins relevant to sugar. Also provide a brief description of how you'll go about making your suggested plugins.&lt;br /&gt;
&lt;br /&gt;
Think of something apart from those implemented already !&lt;br /&gt;
&lt;br /&gt;
Go though the repos you get on this link :&amp;nbsp;&lt;a href="https://github.com/apache?query=cordova-plugin"&gt;https://github.com/apache?query=cordova-plugin&lt;/a&gt; and think of a similar structure for sugar ! For any kind of help, dont hesitate to ping me.&lt;/div&gt;
&lt;/div&gt;
</description><link>http://sugarcordova.blogspot.com/2015/03/important-info-for-gsoc-appplicants.html</link><author>noreply@blogger.com (Puneet Kaur)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4438803281552454032.post-6298826879705090316</guid><pubDate>Tue, 10 Mar 2015 17:11:00 +0000</pubDate><atom:updated>2015-03-22T11:39:48.098-07:00</atom:updated><title>To the students applying for GSOC - Part 2</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
To the students applying this year to the sugar cordova project - I would like to let you all know a few pre-requisites for the project. We expect that students should complete the following before they apply and also include their work in their application, the better you accomplish, more your chances of getting in ! So pull up you sleeves for some real work ;) Here are a list of tasks that you must all look into :&lt;br /&gt;
&lt;br /&gt;
1. Go through all the post on this blog&lt;br /&gt;
2. Go through my sugar cordova related repos on github :&amp;nbsp;https://github.com/puneetgkaur, setup the cordova for sugar with the help of my repos :&amp;nbsp;https://github.com/puneetgkaur/cordova-cli,&amp;nbsp;https://github.com/puneetgkaur/cordova-lib, and&amp;nbsp;https://github.com/puneetgkaur/cordova-plugman. Clone these repos, follow the README on each repo and install cordova for sugar on your system.You should be able to make a simple web app for sugar with the help of this installation by using simple commands : cordova create, cordova platform add sugar, cordova build - you'll get an xo which you must try installing on sugar development environment using sugar-install-bundle command.&lt;br /&gt;
3. Setup your sugar development environment :&amp;nbsp;http://developer.sugarlabs.org/dev-environment.md.html and explore around try making changes in code , see where the code rests and try making a few changes to the code, play around with the GUI and get a feel of the sugar environment if you arent familiar before.&lt;br /&gt;
4. Know all about cordova - from in and out , visit the cordova repos :&amp;nbsp;https://github.com/apache/cordova-lib,&amp;nbsp;https://github.com/apache/cordova-cli,&amp;nbsp;https://github.com/apache/cordova-plugman ,&amp;nbsp;https://github.com/apache/cordova-js and some pltforms repo too :&amp;nbsp;https://github.com/apache/cordova-android,&amp;nbsp;https://github.com/apache/cordova-ios etc. Read the docs :&amp;nbsp;http://cordova.apache.org/docs/en/4.0.0/&lt;br /&gt;
5. Know about sugar -web architecture :&amp;nbsp;http://developer.sugarlabs.org/web-architecture.md.html ,&amp;nbsp;https://github.com/sugarlabs/sugar-web ,&amp;nbsp;https://surajgillespie123.wordpress.com/&lt;br /&gt;
6. Carefully read through the last post of how the cordova plugins are made and &lt;u style="font-weight: bold;"&gt;make a demo plugin for sugar &lt;/u&gt;&amp;nbsp;- note - we want a working prototype of the demo for you to be eligible for the gsoc project - it can be a very simple prototype - just to judge whether you got the workflow or not - if you need help you can mail me.&lt;br /&gt;
7. Suggest a list of plugins you aim to code this summer along with the relevantworkflow as to how you think you'll approach each of them - Note : Its shouldn't be the one in air ! We want a concrete set of list which you think you would accomplish, a result of thorough visualization and observation of yourself of how much time you would take to complete each plugin and what all you can do, a complete list of plugins which you think are feasible and good for the sugar community - If you wish to discuss your ideas feel free to discuss them on mail - note : better the list and more feasible it looks on your profile - higher your chances of getting selected.&lt;br /&gt;
8.Lastly, keep a blog about your progress on these points, a record of all what you have done and whats remaining, a place where you jot down your daily progress on the above points and present to us in a systematic manner and dont forget - we are always there to help you when you need help - email at puneet.gkaur@gmail.com for help if needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All the best guys !!&lt;/div&gt;
</description><link>http://sugarcordova.blogspot.com/2015/03/to-students-applying-for-gsoc-part-2.html</link><author>noreply@blogger.com (Puneet Kaur)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4438803281552454032.post-2484714075432719172</guid><pubDate>Fri, 06 Mar 2015 17:02:00 +0000</pubDate><atom:updated>2015-03-06T09:12:08.256-08:00</atom:updated><title/><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hello all,&lt;br /&gt;
&lt;br /&gt;
So GSOC is back again and we got requests from many students to know more about the project, how the plugins are build etc. I would like to dedicate this post of mine for the students interested in the cordova container for sugar project.&lt;br /&gt;
&lt;br /&gt;
So first a basic layout of the project and what we trying to accomplish. Through the cordova container our aim is to enable the web apps with the sugar compatibility. What does that mean ? It means that the web developers dont need to care about the hardware dependencies or not even care about digging into the native code when developing their app. They simply need to call the standard cordova api to do their job. This would enable their apps to be cross platform and they can simply compile their app for sugar and Taaa daa !! it transforms into an activity ready to run.&lt;br /&gt;
&lt;br /&gt;
Now we need to do 2 things here : 1. develop the cordova cli for sugar 2. Develop the plugin which enable the backend for the apps.&lt;br /&gt;
&lt;br /&gt;
Last year we were able to successfully accomplish the bridging of cordova and sugar and also develop a few plugins and showcased the usage via a sugar activity. This time's task would be around making more plugins and showing the use with the relevant activity and also incorporating the plugins into existing activities. I wish all the best to the students applying this year !&lt;br /&gt;
&lt;br /&gt;
An overview of how plugins are made :&lt;br /&gt;
&lt;br /&gt;
For a plugin we have two side : one javascript side and the other native side.So for each plugin we need code on both the ends. So must be proficient enough in both javascript as well as python ! Have a look at this repo of mine :&lt;a href="https://github.com/puneetgkaur/cordova-plugins"&gt;&amp;nbsp;https://github.com/puneetgkaur/cordova-plugins&lt;/a&gt; . So for example lets take up accelerometer to explain things, the code on javascript side lies here :&amp;nbsp;&lt;a href="https://github.com/puneetgkaur/cordova-plugins/tree/master/accelerometer/accelerometer_plugin/org.apache.cordova.device-motion/src/sugar"&gt;https://github.com/puneetgkaur/cordova-plugins/tree/master/accelerometer/accelerometer_plugin/org.apache.cordova.device-motion/src/sugar&lt;/a&gt; do have a look into this file.&lt;br /&gt;
&lt;br /&gt;
We define an object :&lt;a href="https://github.com/puneetgkaur/cordova-plugins/blob/master/accelerometer/accelerometer_plugin/org.apache.cordova.device-motion/src/sugar/accelerometer.js#L56"&gt;&amp;nbsp;https://github.com/puneetgkaur/cordova-plugins/blob/master/accelerometer/accelerometer_plugin/org.apache.cordova.device-motion/src/sugar/accelerometer.js#L56&lt;/a&gt; with functions start, stop .&lt;br /&gt;
&lt;br /&gt;
The communication to the native side happens through this line :&amp;nbsp;&lt;a href="https://github.com/puneetgkaur/cordova-plugins/blob/master/accelerometer/accelerometer_plugin/org.apache.cordova.device-motion/src/sugar/accelerometer.js#L41"&gt;https://github.com/puneetgkaur/cordova-plugins/blob/master/accelerometer/accelerometer_plugin/org.apache.cordova.device-motion/src/sugar/accelerometer.js#L41&lt;/a&gt; and we pass the arguments "Acceleration" , "GetCurrentAcceleration" respectively&lt;br /&gt;
&lt;br /&gt;
We recieved the parameters pasased through the javascript side on the native side through the function here :&amp;nbsp;&lt;a href="https://github.com/puneetgkaur/sugar/blob/master/src/jarabe/apisocket.py#L106"&gt;https://github.com/puneetgkaur/sugar/blob/master/src/jarabe/apisocket.py#L106&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Once we have the parameters with us on the native side we then pass them on to the respective code though the piece of code here :&amp;nbsp;&lt;a href="https://github.com/puneetgkaur/sugar-toolkit-gtk3/blob/master/src/sugar3/cordova/cordovaSocket.py#L13"&gt;https://github.com/puneetgkaur/sugar-toolkit-gtk3/blob/master/src/sugar3/cordova/cordovaSocket.py#L13&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
So eventually our cordova accelerometer call lands us to the accelerometer code on the native side residing here :&amp;nbsp;&lt;a href="https://github.com/puneetgkaur/sugar-toolkit-gtk3/blob/master/src/sugar3/cordova/accelerometer.py#L5"&gt;https://github.com/puneetgkaur/sugar-toolkit-gtk3/blob/master/src/sugar3/cordova/accelerometer.py#L5&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The response is sent via this line :&amp;nbsp;&lt;a href="https://github.com/puneetgkaur/sugar-toolkit-gtk3/blob/master/src/sugar3/cordova/accelerometer.py#L16"&gt;https://github.com/puneetgkaur/sugar-toolkit-gtk3/blob/master/src/sugar3/cordova/accelerometer.py#L16&lt;/a&gt; back to the javascript code.&lt;br /&gt;
&lt;br /&gt;
I hope this makes things a bit clear. The main communication within javascript from the bus.sendmessage to the apisocket function can be handled as seperate topic as it depends on the sugae web framework developed seperately.&lt;br /&gt;
&lt;br /&gt;
So for this project you shall need to develop the native ends as well. You must be proficient with python and secondly must know the sugar code as well. So early you start the better position you would be in to know things and do it in a better way. All the best once again to the prospective students :) I hope we shall &amp;nbsp;get in a new set of talented developers this time round too :-)&lt;br /&gt;
&lt;br /&gt;
Incase of help dont hesitate to drop a mail at &lt;a href="mailto:puneet.gkaur@gmail.com"&gt;puneet.gkaur@gmail.com&lt;/a&gt;&lt;/div&gt;
</description><link>http://sugarcordova.blogspot.com/2015/03/hello-all-so-gsoc-is-back-again-and-we.html</link><author>noreply@blogger.com (Puneet Kaur)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4438803281552454032.post-2795732387337075640</guid><pubDate>Sat, 30 Aug 2014 16:45:00 +0000</pubDate><atom:updated>2014-09-01T02:53:46.129-07:00</atom:updated><title>The Final Post</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
Sorry people, been a long time since the previous post. The reason being I was busy coding up the plugins and things, so never got much time to concentrate on posting side. Never mind, we are back with a whole wrap up post for all of you. Also made videos to demonstrate the concept.Hope you find it interesting.&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
Its been months of hard work and thought process. Days full with coding and exploring things in and out. Must say it has been a great experience working for Sugarlabs as a part of Google Summer of Code. My mentor , Lionel Lask&lt;span style="font-size: 12.727272033691406px;"&gt;é&lt;/span&gt;&lt;span style="font-size: 12.727272033691406px;"&gt;&amp;nbsp;, has a great share to that, he has been very supportive in all the adventures and trusted upon me which infact boost my motivation to work for the project. I have seen mentors forcing their students to accept their methodology and do the way they want , but the best thing I liked about this was the exploration part, where we were free to dive into the different parts of code, swim through them till we got our treasure ;-) During this exploration we faced many issues, but thanks to the support of Gonzalo and Walter who used to help us whenever we required.I use to trouble Gonzalo a lot when it came to the native part of plugins, asking him how that could be done or why it didnt work as expected. Thanks Gonzalo for your support and time without which I guess the project wouldn't have been where it is.&lt;/span&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
Things still remain, but I hope to work on it after gsoc too :-) gsoc has been just a medium to be introduced to such a lovely community and I would like to thank Google for that , for introducing such a wonderful programme which brings together the developers and students to make some magic ;-)&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
Talking about the project progress - it is through with the cli part and plugins like - accelerometer, camera, dialog,device, globalization and network. We hope to develop more and improve upon those which we already have. Also we aim to club this with sugarizer. I had decided to make some videos during mid of August showing the working but the week which I kept for making videos , suddenly my system crashed ( because of update from ubuntu 12.04 to 14.04) so instead of making videos, I had to debug it and bring it back to the working state.Now its up and working :-) (thankfully ! ) I made a few videos to give you all an idea of what we have tried to achieve. Please go through these ( Make sure to switch on the subtitles if not already ):&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/ylhXaQsm5dQ?feature=player_embedded' frameborder='0'&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px; text-align: center;"&gt;
Making a sugar activity from web app using cordovoa&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/hCdlKtoivH0?feature=player_embedded' frameborder='0'&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px; text-align: center;"&gt;
Demo of the plugins coded through the summer&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px; text-align: left;"&gt;
Hope you find the video useful,&lt;span style="font-size: 12.727272033691406px;"&gt;Here is the repo link which you would require incase you decide to play around with the code&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/puneetgkaur/sugar-cordova" style="color: #1155cc; font-size: 12.727272033691406px;" target="_blank"&gt;https://github.com/&lt;wbr&gt;&lt;/wbr&gt;puneetgkaur/sugar-cordova&lt;/a&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px; text-align: left;"&gt;
&lt;span style="font-size: 12.727272033691406px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px; text-align: left;"&gt;
&lt;span style="font-size: 12.727272033691406px;"&gt;Also as the project is not completed we would be up on it and pushing more changes , so keep around ;-)&lt;/span&gt;&lt;span style="font-size: 12.727272033691406px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://sugarcordova.blogspot.com/2014/08/the-final-post.html</link><author>noreply@blogger.com (Puneet Kaur)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4438803281552454032.post-1176654775886823054</guid><pubDate>Tue, 22 Jul 2014 13:52:00 +0000</pubDate><atom:updated>2014-07-22T10:03:48.926-07:00</atom:updated><title>Working of sugar cordova</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
Hey,&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
So its been some time after the previous post and we have made some serious progress after that :-)&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
The &amp;nbsp;work undertaken and done are as follows :&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
1. Improving upon on the codebase for cli&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
2. Making the basic layer for cordova for sugar to add plugins upon it&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
3. Making cli work on the windows platform&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
4. Completing accelerometer&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
5. Working on camera&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
So to discuss what we have got through this time ,I would like to take you through an example of a simple Hello World app , telling you how you can generate your own .xo from any web app and deploy it to your sugar environment.&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
To be precise, a web app signifies a bundle of files written in html,js and css and having some backend logic to perform a concrete task.Now the point concerning here is to get that web app to your sugar environment. The steps involved would be :&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
1. Setup your development environment - follow the instruction mentioned &lt;a href="http://wiki.sugarlabs.org/go/Sugar_Cordova#INSTRUCTIONS_TO_SET_UP_SUGAR_CORDOVA"&gt;here&lt;/a&gt;&lt;/div&gt;
&lt;div style="font-size: 12.727272033691406px;"&gt;
&lt;span style="font-family: arial, sans-serif;"&gt;&lt;span style="background-color: white; color: #222222;"&gt;2. Issue &amp;nbsp;the following command to&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;to create a new cordova app :&lt;/span&gt;&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;span style="font-family: arial, sans-serif;"&gt;&lt;span style="background-color: black;"&gt;&lt;span style="color: white;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background-color: black; color: white; font-family: Courier New, Courier, monospace;"&gt;cordova create &amp;lt;app_directory&amp;gt; &amp;lt;app_package_name&amp;gt; &amp;lt;app_name&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
3. Now insert all your web app stuff to the www directory of the newly created project&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
4. To convert this web app to the .xo isa two step process :&amp;nbsp;&lt;/div&gt;
&lt;div style="font-size: 12.727272033691406px;"&gt;
&lt;span style="background-color: white; color: #222222; font-family: arial, sans-serif;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(i) first add the sugar platform to your newly created cordova project by using command :&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;span style="background-color: black; color: white; font-family: Courier New, Courier, monospace;"&gt;cordova platform add sugar&lt;/span&gt;&lt;span style="background-color: white; color: #222222; font-family: arial, sans-serif;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style="font-size: 12.727272033691406px;"&gt;
&lt;div style="text-align: center;"&gt;
&lt;span style="background-color: white; color: #222222; font-family: arial, sans-serif;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(ii) Then you build the project after making changes to web app if you wish to make any; by the command:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: black; color: white; font-family: Courier New, Courier, monospace;"&gt;cordova build sugar&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(iii) Find your newly create .xo in app_directory/platforms/sugar/&lt;wbr&gt;&lt;/wbr&gt;cordova/&amp;lt;app_name&amp;gt;.xo&lt;/div&gt;
&lt;div style="font-size: 12.727272033691406px;"&gt;
&lt;span style="background-color: white; color: #222222; font-family: arial, sans-serif;"&gt;5. Now we can copy and paste the .xo in our sugar environment and issue the following&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;command to install the xo :&lt;/span&gt;&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;span style="background-color: white; color: #222222; font-family: arial, sans-serif;"&gt;&lt;/span&gt;&lt;span style="background-color: black; color: white; font-family: Courier New, Courier, monospace;"&gt;sugar-install-bundle &amp;lt;name&amp;gt;.xo&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
FEW IMPORTANT NOTES :&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
1.As an added feature we have provided a --noframe option to the users who already know about sugar web. In that case we shall add no sugar -web feature in the index.html, that means the app_directory/www/index.html must contains all the toolbar and sugar ui related stuff like the index.html in the sugar-web-template. If you give no option in the build command, it is by default assumed that you dont know about sugar web and your web page is added in an iframe in the final index.html along with the sugar ui which is added around it. So you gotto decidie whether to leave the option of adding the sugar ui to the cordova-cli or do it on own. For the former you dont need any option and its activated by default while the later can be acheived by issuing the --noiframe option along.&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
2.In the windows environment the zip command that is used to create the .xo by the cordova build command doesn't work. So we provide an alternative for that. All the windows users are expected to set an environment variable name ZIPCOMMAND to something similar to the "zip -r" for windows. That is, it should be able to create a zip file recursively, as an option , people can use 7zip which gives an excellent command line tool for creating zips. So install 7zip and issue the following command before issuing cordova build command on windows :&amp;nbsp;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;span style="white-space: pre-wrap;"&gt; &lt;/span&gt;set ZIPCOMMAND="c:\Program Files\7-Zip\7z.exe" a -r -tzip -aoa&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
Apart from this, we are currently working on providing you with various plugins for cordova which shall make the communication with the device capabilities easier. You can find the plugins here :&amp;nbsp;&lt;a href="https://github.com/puneetgkaur/cordova-plugins" style="color: #1155cc;" target="_blank"&gt;https://github.com/&lt;wbr&gt;&lt;/wbr&gt;puneetgkaur/cordova-plugins&lt;/a&gt;&amp;nbsp;, so in this repository we have two folders : one for the plugin and other a sample sugar cordova with the concerned plugin.&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style="text-align: left;"&gt;
&lt;u&gt;&lt;b&gt;Have a look at the sample web app we used :&amp;nbsp;&lt;/b&gt;&lt;/u&gt;&lt;/h3&gt;
&lt;br /&gt;
Screenshot of the web app in the browser :&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif;"&gt;
&lt;div style="font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; font-size: 12.727272033691406px; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYTAVVYEoOBNKQ0aCgugZSAx23Rnkk9Tqb6Q2cQTj2ylZlbpWzNqXMsTo54WipBierOMBk6Ptccu94I-p0u-U2ANdnjmMPW3RQSvAoGrq3XovcocOIYH5QP4MciUOh5rOhb6BRRDRSaNE/s1600/Screenshot+from+2014-07-22+17:51:01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYTAVVYEoOBNKQ0aCgugZSAx23Rnkk9Tqb6Q2cQTj2ylZlbpWzNqXMsTo54WipBierOMBk6Ptccu94I-p0u-U2ANdnjmMPW3RQSvAoGrq3XovcocOIYH5QP4MciUOh5rOhb6BRRDRSaNE/s1600/Screenshot+from+2014-07-22+17:51:01.png" height="203" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-size: 12.727272033691406px;"&gt;
The web app as in the sugar shell :&lt;/div&gt;
&lt;div style="font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; font-size: 12.727272033691406px; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIctTBJhFJPJTRJoQvmTR4hYXoOpZpZG49vEHNDnRPx8uK5GQDXfS6QceCuHazVfyDjOazGtsT9sH_LGHNQAyzF8t-IheXfILJhfZNSDOvxT2OhjYTKq1k6Zv0N5ilbB99M6xJkuFyG_0/s1600/Screenshot+from+2014-07-22+18:06:40.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIctTBJhFJPJTRJoQvmTR4hYXoOpZpZG49vEHNDnRPx8uK5GQDXfS6QceCuHazVfyDjOazGtsT9sH_LGHNQAyzF8t-IheXfILJhfZNSDOvxT2OhjYTKq1k6Zv0N5ilbB99M6xJkuFyG_0/s1600/Screenshot+from+2014-07-22+18:06:40.png" height="200" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="font-size: 12.727272033691406px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; font-family: arial, sans-serif;"&gt;
&lt;div style="color: #222222;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="color: #222222;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="color: #222222;"&gt;
Source of the sample web app :&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;span style="color: #741b47;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;span style="color: #741b47; font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;span style="color: #741b47; font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;html&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;    &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;head&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;        &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;meta charset="utf-8" /&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;        &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;meta name="format-detection" content="telephone=no" /&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;        &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 --&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;        &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;        &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;link rel="stylesheet" type="text/css" href="css/index.css" /&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;        &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;meta name="msapplication-tap-highlight" content="no" /&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;        &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;title&amp;gt;Hello World&amp;lt;/title&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;    &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;/head&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;    &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;body&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;        &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;div class="app"&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;            &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;h1&amp;gt;Apache Cordova&amp;lt;/h1&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;            &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;div id="deviceready" class="blink"&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;                &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;p class="event listening"&amp;gt;Connecting to Device&amp;lt;/p&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;                &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b style="color: #741b47; font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;p class="event received"&amp;gt;Device is Ready&amp;lt;/p&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;            &amp;lt;/div&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;        &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;/div&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;        &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;script type="text/javascript" src="cordova.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;        &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;script type="text/javascript" src="js/index.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;        &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;            &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;app.initialize();&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;        &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;/script&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;    &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&amp;lt;/body&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;
&lt;div style="text-align: left;"&gt;
&lt;span style="color: #741b47;"&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
We'll hope to be back with &amp;nbsp;a lot of cool developments on the plugin development front, so till then enjoy experimenting with sugary cordova ;-)&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://sugarcordova.blogspot.com/2014/07/working-of-sugar-cordova.html</link><author>noreply@blogger.com (Puneet Kaur)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYTAVVYEoOBNKQ0aCgugZSAx23Rnkk9Tqb6Q2cQTj2ylZlbpWzNqXMsTo54WipBierOMBk6Ptccu94I-p0u-U2ANdnjmMPW3RQSvAoGrq3XovcocOIYH5QP4MciUOh5rOhb6BRRDRSaNE/s72-c/Screenshot+from+2014-07-22+17:51:01.png" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4438803281552454032.post-8199166888512643151</guid><pubDate>Mon, 23 Jun 2014 12:34:00 +0000</pubDate><atom:updated>2014-07-22T10:05:59.215-07:00</atom:updated><title>our journey with cordova-cli</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hey folks !&lt;br /&gt;
&lt;br /&gt;
So we are back with a new post.This time would rather prefer to tell you a kinda story of how we fought we with cordova-cli and finally captured it in our captivity :P :P&lt;br /&gt;
Yeah .. Its time to celebrate .. But the success is at very initial stage right now.Getting stucked up with cli was disheartening, but conquering it was heartwarming :D&lt;br /&gt;
&lt;br /&gt;
So to start, we aimed to make the various cordova cli commands work for sugar.All we knew was that we had to push some changes in the cordova-cli package.So quickly searched up where the cordova-cli code lied and downloaded it.Well, to our surprize, the cli code was nothing but a pointer to cordova-lib which was actually the backbone.So downloaded lib too ! But where do the both meet ? How to make them work together ? Though we had some documentation in the readme of cordova-lib.. but ahh .. it didn't work as expected.Spent days to figure what was wrong.Finally after hours of research, found a way to work around.&lt;br /&gt;
&lt;br /&gt;
so let me get you know how we fixed up the things to let our changes in our local directory reflect in the cli on the terminal. The first was the discovery of ~/.cordova directory from where the library code for all the platforms is fetched once downloaded from their respective urls.This is the directory which enables us to copy the templates when we issue the cordova platform add command.Next, the correct linking between cordova-cli and cordova-lib,for this we had to go into cordova-cli directory and issue the npm link from there for cordova-lib.Once cordova-lib is there in the cordova-cli/node_modules then the changes done in directory cordova-cli/node_modules/cordova-lib &amp;nbsp;get it reflected on terminal.But we have to be cautious to remove the cordova executable file from usr/lib/bin directory which may be residing there from earlier installation of cordova-cli.Lastly to get a feel of our changes we move to cordova-cli/bin and run the cordova executable file present there.&lt;br /&gt;
&lt;br /&gt;
Now let me take you through the digging we have done in the cordova-cli code. Firstly the executable that we run inside the bin folder of cordova-cli, simply calls cli.js of cordova-cli with process.args ( the arguments we provide) , the cli then calls for cordova-lib.js of cordova-lib in node_modules.Obviously apart from the cordova-lib, we do need a few other node dependencies as well.&lt;br /&gt;
&lt;br /&gt;
Cordova-lib.js defines various files to be used with different commands - see &lt;a href="https://github.com/apache/cordova-lib/blob/master/cordova-lib/cordova-lib.js"&gt;here&lt;/a&gt;. So for the cordova commands, we are directed to the cordova.js inside cordova-lib/cordova.There &lt;a href="https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/cordova/cordova.js#L60"&gt;different modules&lt;/a&gt;&amp;nbsp;which eventually cater to our various category of commands like create, platform add etc are added.&lt;br /&gt;
&lt;br /&gt;
For cordova create command, create.js in cordova-lib simply makes a new project with the specified directory name,id and app name but with no specific platform. To add a platform we issue ' cordova platform add &amp;lt;platform name &amp;gt;'. This calls for the platform.js.It looks in platforms.js [note a difference of 's' in platforms ;-) ] to see if there is an entry for the specified platform.If not it issues an error, else it downloads the platform's library from the url specified in platforms.js.Its only when the command is issued first time for the specified platform that cli downloads it else ~/.cordova/lib/&amp;lt;platform&amp;gt;/&amp;lt;version&amp;gt; is referred for the platform project template.The 'create' file in ~/.cordova/lib/&amp;lt;platform&amp;gt;/&amp;lt;version&amp;gt; /lib folder contains the platform specific script to add the files from the platform's library to the cordova project.&lt;br /&gt;
&lt;br /&gt;
Once the platform has been added to the project, we then need to build project after coding up our logic in the app.For this the build command is broken into two parts, prepare and compile.The prepare part copies all the updated parts from the global www folder - projectDirectory/www to the native platform's www folder - projectDirectory/platform/&amp;lt;platform name&amp;gt;/www, it also updates the app name, package name,icons etc and installs and uninstalls the plugins through plugman.Once the relevant web stuff has been added to the native platform compile part then runs a script using superspawn.js which converts the web stuff to the native platform package.&lt;br /&gt;
&lt;br /&gt;
So as far as today we are building upon the build command and hope to finish it soon :-)&lt;br /&gt;
&lt;br /&gt;
A visual representation of all explained above can be found below ..&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://wiki.sugarlabs.org/images/c/ca/Cordova_CLI.pdf"&gt;&lt;img border="0" src="http://wiki.sugarlabs.org/images/2/26/Cordova_cli.jpg" height="480" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://sugarcordova.blogspot.com/2014/06/our-journey-with-cordova-cli.html</link><author>noreply@blogger.com (Puneet Kaur)</author><thr:total>0</thr:total><enclosure length="485985" type="application/pdf" url="http://wiki.sugarlabs.org/images/c/ca/Cordova_CLI.pdf"/><itunes:explicit>no</itunes:explicit><itunes:subtitle>Hey folks ! So we are back with a new post.This time would rather prefer to tell you a kinda story of how we fought we with cordova-cli and finally captured it in our captivity :P :P Yeah .. Its time to celebrate .. But the success is at very initial stage right now.Getting stucked up with cli was disheartening, but conquering it was heartwarming :D So to start, we aimed to make the various cordova cli commands work for sugar.All we knew was that we had to push some changes in the cordova-cli package.So quickly searched up where the cordova-cli code lied and downloaded it.Well, to our surprize, the cli code was nothing but a pointer to cordova-lib which was actually the backbone.So downloaded lib too ! But where do the both meet ? How to make them work together ? Though we had some documentation in the readme of cordova-lib.. but ahh .. it didn't work as expected.Spent days to figure what was wrong.Finally after hours of research, found a way to work around. so let me get you know how we fixed up the things to let our changes in our local directory reflect in the cli on the terminal. The first was the discovery of ~/.cordova directory from where the library code for all the platforms is fetched once downloaded from their respective urls.This is the directory which enables us to copy the templates when we issue the cordova platform add command.Next, the correct linking between cordova-cli and cordova-lib,for this we had to go into cordova-cli directory and issue the npm link from there for cordova-lib.Once cordova-lib is there in the cordova-cli/node_modules then the changes done in directory cordova-cli/node_modules/cordova-lib &amp;nbsp;get it reflected on terminal.But we have to be cautious to remove the cordova executable file from usr/lib/bin directory which may be residing there from earlier installation of cordova-cli.Lastly to get a feel of our changes we move to cordova-cli/bin and run the cordova executable file present there. Now let me take you through the digging we have done in the cordova-cli code. Firstly the executable that we run inside the bin folder of cordova-cli, simply calls cli.js of cordova-cli with process.args ( the arguments we provide) , the cli then calls for cordova-lib.js of cordova-lib in node_modules.Obviously apart from the cordova-lib, we do need a few other node dependencies as well. Cordova-lib.js defines various files to be used with different commands - see here. So for the cordova commands, we are directed to the cordova.js inside cordova-lib/cordova.There different modules&amp;nbsp;which eventually cater to our various category of commands like create, platform add etc are added. For cordova create command, create.js in cordova-lib simply makes a new project with the specified directory name,id and app name but with no specific platform. To add a platform we issue ' cordova platform add &amp;lt;platform name &amp;gt;'. This calls for the platform.js.It looks in platforms.js [note a difference of 's' in platforms ;-) ] to see if there is an entry for the specified platform.If not it issues an error, else it downloads the platform's library from the url specified in platforms.js.Its only when the command is issued first time for the specified platform that cli downloads it else ~/.cordova/lib/&amp;lt;platform&amp;gt;/&amp;lt;version&amp;gt; is referred for the platform project template.The 'create' file in ~/.cordova/lib/&amp;lt;platform&amp;gt;/&amp;lt;version&amp;gt; /lib folder contains the platform specific script to add the files from the platform's library to the cordova project. Once the platform has been added to the project, we then need to build project after coding up our logic in the app.For this the build command is broken into two parts, prepare and compile.The prepare part copies all the updated parts from the global www folder - projectDirectory/www to the native platform's www folder - projectDirectory/platform/&amp;lt;platform name&amp;gt;/www, it also updates the app name, package name,icons etc and installs and uninstalls the plugins through plugman.Once the relevant web stuff has been added to the native platform compile part then runs a script using superspawn.js which converts the web stuff to the native platform package. So as far as today we are building upon the build command and hope to finish it soon :-) A visual representation of all explained above can be found below ..</itunes:subtitle><itunes:author>noreply@blogger.com (Puneet Kaur)</itunes:author><itunes:summary>Hey folks ! So we are back with a new post.This time would rather prefer to tell you a kinda story of how we fought we with cordova-cli and finally captured it in our captivity :P :P Yeah .. Its time to celebrate .. But the success is at very initial stage right now.Getting stucked up with cli was disheartening, but conquering it was heartwarming :D So to start, we aimed to make the various cordova cli commands work for sugar.All we knew was that we had to push some changes in the cordova-cli package.So quickly searched up where the cordova-cli code lied and downloaded it.Well, to our surprize, the cli code was nothing but a pointer to cordova-lib which was actually the backbone.So downloaded lib too ! But where do the both meet ? How to make them work together ? Though we had some documentation in the readme of cordova-lib.. but ahh .. it didn't work as expected.Spent days to figure what was wrong.Finally after hours of research, found a way to work around. so let me get you know how we fixed up the things to let our changes in our local directory reflect in the cli on the terminal. The first was the discovery of ~/.cordova directory from where the library code for all the platforms is fetched once downloaded from their respective urls.This is the directory which enables us to copy the templates when we issue the cordova platform add command.Next, the correct linking between cordova-cli and cordova-lib,for this we had to go into cordova-cli directory and issue the npm link from there for cordova-lib.Once cordova-lib is there in the cordova-cli/node_modules then the changes done in directory cordova-cli/node_modules/cordova-lib &amp;nbsp;get it reflected on terminal.But we have to be cautious to remove the cordova executable file from usr/lib/bin directory which may be residing there from earlier installation of cordova-cli.Lastly to get a feel of our changes we move to cordova-cli/bin and run the cordova executable file present there. Now let me take you through the digging we have done in the cordova-cli code. Firstly the executable that we run inside the bin folder of cordova-cli, simply calls cli.js of cordova-cli with process.args ( the arguments we provide) , the cli then calls for cordova-lib.js of cordova-lib in node_modules.Obviously apart from the cordova-lib, we do need a few other node dependencies as well. Cordova-lib.js defines various files to be used with different commands - see here. So for the cordova commands, we are directed to the cordova.js inside cordova-lib/cordova.There different modules&amp;nbsp;which eventually cater to our various category of commands like create, platform add etc are added. For cordova create command, create.js in cordova-lib simply makes a new project with the specified directory name,id and app name but with no specific platform. To add a platform we issue ' cordova platform add &amp;lt;platform name &amp;gt;'. This calls for the platform.js.It looks in platforms.js [note a difference of 's' in platforms ;-) ] to see if there is an entry for the specified platform.If not it issues an error, else it downloads the platform's library from the url specified in platforms.js.Its only when the command is issued first time for the specified platform that cli downloads it else ~/.cordova/lib/&amp;lt;platform&amp;gt;/&amp;lt;version&amp;gt; is referred for the platform project template.The 'create' file in ~/.cordova/lib/&amp;lt;platform&amp;gt;/&amp;lt;version&amp;gt; /lib folder contains the platform specific script to add the files from the platform's library to the cordova project. Once the platform has been added to the project, we then need to build project after coding up our logic in the app.For this the build command is broken into two parts, prepare and compile.The prepare part copies all the updated parts from the global www folder - projectDirectory/www to the native platform's www folder - projectDirectory/platform/&amp;lt;platform name&amp;gt;/www, it also updates the app name, package name,icons etc and installs and uninstalls the plugins through plugman.Once the relevant web stuff has been added to the native platform compile part then runs a script using superspawn.js which converts the web stuff to the native platform package. So as far as today we are building upon the build command and hope to finish it soon :-) A visual representation of all explained above can be found below ..</itunes:summary></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4438803281552454032.post-3357802732679211456</guid><pubDate>Wed, 11 Jun 2014 10:10:00 +0000</pubDate><atom:updated>2014-06-11T03:10:50.696-07:00</atom:updated><title>A quick update</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
This week's post is gonna be a bit short.I'll discuss what all we have explored and what we plan to do next.&lt;br /&gt;
&lt;br /&gt;
So the previous week, as per the irc meeting, we &amp;nbsp;had decided to document up the things done and analyze what more we want to do. We had been focussing more on the code front till then but we decided to shift our focus to "thinking" for a week.So basically it was to analyze the different possible paths and define our goals in a better way and be sure of them.&lt;br /&gt;
&lt;br /&gt;
I documented in details the code we have written, why we wrote that, mapping between what cordova wiki mentions and what we have done and what we need to do next. You can access it &lt;a href="https://docs.google.com/document/d/152TgV-Jliu_wgloOPIu_o5L94fOd7zPoCrhZ399Kl7s/edit?usp=sharing"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
So yesterday we discussed on irc the path we must now follow.For this week, we shall be focussing on cordova-cli and try to come up with the accelerometer plugin. As I dont have an xo currently with me, I would be simulating using a linux file.&lt;br /&gt;
&lt;br /&gt;
Once the cordova-cli is done with we shall be able to convert a simple html page to a full blown .xo file which can be installed on the sugar. We hope to do this asap but currently we are facing a lot of issues to be resolved. Hope to get some results soon !&lt;/div&gt;
</description><link>http://sugarcordova.blogspot.com/2014/06/a-quick-update.html</link><author>noreply@blogger.com (Puneet Kaur)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4438803281552454032.post-7583920985939030663</guid><pubDate>Fri, 06 Jun 2014 20:27:00 +0000</pubDate><atom:updated>2014-06-06T13:30:36.708-07:00</atom:updated><title>How to create activities with sugar web and help them communicate with python</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;"&gt;In the middle of my posts related to the sugar cordova project, I would also like to share a simple and straight process to develop activities on sugar web and help them communicate with native python.&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="color: #222222; font-family: arial, sans-serif; font-size: x-small;"&gt;&lt;span style="background-color: white;"&gt;This post is to help all the developers out there who might as well want to develop some cool activities for sugar using sugar web and might need to communicate with the native python back end using the javascript-python bridge.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #222222; font-family: arial, sans-serif; font-size: x-small;"&gt;&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="color: #222222; font-family: arial, sans-serif; font-size: x-small;"&gt;&lt;span style="background-color: white;"&gt;So here go the steps which you must follow :&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;"&gt;1. Setup up the sugar development environment :&amp;nbsp;&lt;/span&gt;&lt;a href="http://developer.sugarlabs.org/dev-environment.md.html" style="background-color: white; color: #1155cc; font-family: arial, sans-serif; font-size: 12.800000190734863px;" target="_blank"&gt;http://developer.sugarlabs.&lt;wbr&gt;&lt;/wbr&gt;org/dev-environment.md.html&lt;/a&gt;&lt;br /&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;"&gt;
2. Create a sample activity through command line - follow the steps mentioned here :&amp;nbsp;&lt;a href="http://developer.sugarlabs.org/activity.md.html" style="color: #1155cc;" target="_blank"&gt;http://developer.sugarlabs.&lt;wbr&gt;&lt;/wbr&gt;org/activity.md.html&lt;/a&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;"&gt;
3.Once you are done with the initial set up of your activity then you can jump into more details, here are a few pointers on how to set up a link between native side and the javascript side using sugar web -&amp;nbsp;&lt;/div&gt;
&lt;div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;"&gt;
&lt;ul&gt;
&lt;li style="margin-left: 15px;"&gt;Compare&amp;nbsp;&lt;a href="https://github.com/surajgillespie/Object-Chooser/blob/master/lib/sugar-web/activity/activity.js" style="color: #1155cc;" target="_blank"&gt;this file&lt;/a&gt;&amp;nbsp;with the file given&amp;nbsp;&lt;a href="https://github.com/sugarlabs/sugar/blob/master/src/jarabe/apisocket.py" style="color: #1155cc;" target="_blank"&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;li style="margin-left: 15px;"&gt;A sample call :&amp;nbsp;&lt;a href="https://github.com/surajgillespie/Object-Chooser/blob/master/lib/sugar-web/activity/activity.js#L90" style="color: #1155cc;" target="_blank"&gt;look here&lt;/a&gt;&amp;nbsp;in the first file goes to&amp;nbsp;&lt;a href="https://github.com/sugarlabs/sugar/blob/master/src/jarabe/apisocket.py" style="color: #1155cc;" target="_blank"&gt;this line&amp;nbsp;&lt;/a&gt;in the apisocket.py file&lt;/li&gt;
&lt;li style="margin-left: 15px;"&gt;So basically if we want to implement something on native front and call it in javascript, so code up your class in python in sugar and import it in apisocket.py and then code up a function in activity class of apisocket.py which wraps up the calls to your class or simply you can put your logic in the function itself if its not huge ( for getting started dont go for building a seperate class and importing, code up your logic in a function there itself to test whether it works).&lt;/li&gt;
&lt;li style="margin-left: 15px;"&gt;The function responsible for calling to the native side is&lt;a href="https://github.com/surajgillespie/Object-Chooser/blob/master/lib/sugar-web/activity/activity.js#L99" style="color: #1155cc;" target="_blank"&gt;bus.sendmessage.&lt;/a&gt;It has the following parameters :&lt;/li&gt;
&lt;ul&gt;
&lt;li style="margin-left: 15px;"&gt;&amp;nbsp;the class and function to which call is made : like activity.show_object_chooser&lt;/li&gt;
&lt;li style="margin-left: 15px;"&gt;the parameters which you want to pass are defined in [] like [parameter1,parameter2,....]&lt;/li&gt;
&lt;li style="margin-left: 15px;"&gt;the callback function which has two parameters for the success and failure - when there is success the error object would be null else it shall contain the error&lt;/li&gt;
&lt;/ul&gt;
&lt;li style="margin-left: 15px;"&gt;The call back from native to javascript is made by the&amp;nbsp;&lt;a href="https://github.com/sugarlabs/sugar/blob/master/src/jarabe/apisocket.py#L251" style="color: #1155cc;" target="_blank"&gt;send_result&lt;/a&gt;or&lt;a href="https://github.com/sugarlabs/sugar/blob/master/src/jarabe/apisocket.py#L258" style="color: #1155cc;" target="_blank"&gt;&amp;nbsp;send_error&amp;nbsp;&lt;/a&gt;functions of the API Client class of apisocket.py file - you can see a&amp;nbsp;&lt;a href="https://github.com/sugarlabs/sugar/blob/master/src/jarabe/apisocket.py#L71" style="color: #1155cc;" target="_blank"&gt;sample usage&amp;nbsp;&lt;/a&gt;of these functions in activity class functions of apisocket.py&lt;/li&gt;
&lt;li style="margin-left: 15px;"&gt;So as per your code logic you either call send_error or send_result function - incase of error call send_error or else return the object through send_result&lt;/li&gt;
&lt;li style="margin-left: 15px;"&gt;On the javascript side you check through the&amp;nbsp;&lt;a href="https://github.com/surajgillespie/Object-Chooser/blob/master/lib/sugar-web/activity/activity.js#L91" style="color: #1155cc;" target="_blank"&gt;callback&lt;/a&gt;(3rd parameter of bus.sendmessage) that whether the error is null and invoke&amp;nbsp;&lt;a href="https://github.com/surajgillespie/Object-Chooser/blob/master/lib/sugar-web/activity/activity.js#L95" style="color: #1155cc;" target="_blank"&gt;errorhandler&lt;/a&gt;&amp;nbsp;or&amp;nbsp;&lt;a href="https://github.com/surajgillespie/Object-Chooser/blob/master/lib/sugar-web/activity/activity.js#L93" style="color: #1155cc;" target="_blank"&gt;successhandle&lt;/a&gt;r as per the result&lt;/li&gt;
&lt;li style="margin-left: 15px;"&gt;Inside the apisocket.py function , you can access the parameters passed by :&amp;nbsp;request['params'][0] ,&amp;nbsp;request['params'][1] and so on ...&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I hope the interested developers are benefitted from the post.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
A special thanks to &lt;a href="http://activities.sugarlabs.org/en-US/sugar/user/95"&gt;Manusheel&lt;/a&gt;&amp;nbsp;for motivating me to write this on blog ;-)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://sugarcordova.blogspot.com/2014/06/how-to-creaate-activities-with-sugar.html</link><author>noreply@blogger.com (Puneet Kaur)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4438803281552454032.post-2296417116128255834</guid><pubDate>Sun, 01 Jun 2014 15:28:00 +0000</pubDate><atom:updated>2014-06-01T08:35:28.662-07:00</atom:updated><title>An update of the week's progress</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
So its been a week to the previous post, and I wish to share what all we have experimented with and done during this time.&lt;br /&gt;
&lt;br /&gt;
As discussed in the previous post, we were facing issues with the way cordova modules have been written and the way sugar web defines the js modules.So we need to convert the sugar web styled modules to that of cordova.For this we take the help of nodejs scripts which can do the interconversion between the two.At first we designed a script which was specific to env.js but we had to make it general so that other sugar web js files which have dependencies can also be converted to the cordova format.So we generalized the script.&lt;br /&gt;
&lt;br /&gt;
Apart from this task, we ventured into the waters of cordova cli and found out how we can make the command like cordova platform add sugar and cordova build sugar work.So we have the cordova-cli repository &lt;a href="https://github.com/apache/cordova-cli"&gt;here&lt;/a&gt;&amp;nbsp;which takes care of the command line interface.But now the most of the code of cordova cli has been shifted to &lt;a href="https://github.com/apache/cordova-lib"&gt;this &lt;/a&gt;repository named cordova-lib which has all the code for cordova api's.Here we have the &lt;a href="https://github.com/apache/cordova-lib/tree/master/cordova-lib/src/cordova/metadata"&gt;parsers &lt;/a&gt;for the individual platform which perform the tasks when we give the cordova command.So to make our sugar platform work with the cordova cli we need to make something similar to that.&lt;br /&gt;
&lt;br /&gt;
Now when we are almost through with the basic setup of cordova, so we decided to move ahead to look in for the features of cordova that can be replicated for sugar as well.We are currently studying the various &lt;a href="http://plugins.cordova.io/#/"&gt;plugins&lt;/a&gt;&amp;nbsp;of cordova and trying to understand the complexity of each to implement on sugar.Soon we must be rolling over to the cordova plugin development for sugar ;)&lt;/div&gt;
</description><link>http://sugarcordova.blogspot.com/2014/06/an-update-of-weeks-progress.html</link><author>noreply@blogger.com (Puneet Kaur)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4438803281552454032.post-3611695806886202863</guid><pubDate>Sat, 24 May 2014 10:20:00 +0000</pubDate><atom:updated>2014-05-27T13:20:05.369-07:00</atom:updated><title>The first steps</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Its been around a month and yes we do have made some significant progress.&lt;br /&gt;
&lt;br /&gt;
To start with we basically need to follow the following basic steps for building our cordova wrapper &amp;nbsp;:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Instantiate a chromeless browser. Examples include:&lt;span class="anchor" id="line-6"&gt;&lt;/span&gt;&lt;ul&gt;
&lt;li&gt;&lt;div class="line891" style="margin-bottom: 0.25em; margin-top: 0.25em;"&gt;
&lt;a class="http" href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/" style="border: 0px; color: #0044aa; text-decoration: none;"&gt;iOS WebView&lt;/a&gt;&lt;span class="anchor" id="line-7"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div class="line891" style="margin-bottom: 0.25em; margin-top: 0.25em;"&gt;
&lt;a class="http" href="http://developer.android.com/reference/android/webkit/WebView.html" style="border: 0px; color: #0044aa; text-decoration: none;"&gt;Android WebView&lt;/a&gt;&lt;span class="anchor" id="line-8"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div class="line862" style="margin-bottom: 0.25em; margin-top: 0.25em;"&gt;
The&amp;nbsp;&lt;a class="https" href="https://bdsc.webapps.blackberry.com/html5/" style="border: 0px; color: #0044aa; text-decoration: none;"&gt;BlackBerry WebWorks framework&lt;/a&gt;&amp;nbsp;instantiates its own chromeless browser&lt;span class="anchor" id="line-9"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div class="line891" style="margin-bottom: 0.25em; margin-top: 0.25em;"&gt;
&lt;a class="http" href="http://msdn.microsoft.com/en-us/library/microsoft.phone.controls.webbrowser(v=vs.92).aspx" style="border: 0px; color: #0044aa; text-decoration: none;"&gt;Windows Phone 7 WebBrowser&lt;/a&gt;&lt;span class="anchor" id="line-10"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Load packaged www assets (HTML/CSS/JS)&lt;/li&gt;
&lt;li&gt;Enable a bridge between native framework and the web view&lt;/li&gt;
&lt;li&gt;&lt;div class="line862" style="margin-bottom: 0.25em; margin-top: 0.25em;"&gt;
Integrate a new platform into the&amp;nbsp;&lt;a class="http" href="http://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=summary" style="border: 0px; color: #0044aa; text-decoration: none;"&gt;cordova-js project&lt;/a&gt;. This is a common API for sending messages and triggering error and success callbacks with native framework responses.&lt;span class="anchor" id="line-15"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div class="line862" style="margin-bottom: 0.25em; margin-top: 0.25em;"&gt;
Ensure the&amp;nbsp;&lt;a class="http" href="http://git-wip-us.apache.org/repos/asf?p=cordova-mobile-spec.git;a=summary" style="border: 0px; color: #0044aa; text-decoration: none;"&gt;mobile-spec tests&lt;/a&gt;&amp;nbsp;pass&lt;span class="anchor" id="line-16"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div class="line862" style="margin-bottom: 0.25em; margin-top: 0.25em;"&gt;
Update the&amp;nbsp;&lt;a class="http" href="http://git-wip-us.apache.org/repos/asf?p=cordova-docs.git;a=summary" style="border: 0px; color: #0044aa; text-decoration: none;"&gt;documentation&lt;/a&gt;&amp;nbsp;where applicable&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;
The first of these is there and the second we leave for the end.Coming to the bridging work, its foundation has already been laid by the sugar web framework.&lt;br /&gt;
&lt;br /&gt;
Our aim now is to provide a common cordova api in front and the native backend support for it.We look for what are the elements required in the basic cordova.js.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
cordova.js is the javascript file that is incorporated in every cordova project on the web code front. It basically contains all the cordova libraries along with the code that interacts with the native side of each platform.This code is to be specific to each platform.Have a look here : &lt;a href="https://github.com/apache/cordova-js/tree/master/src"&gt;cordova-js&amp;nbsp;code&lt;/a&gt;.The common directory there contains all the code that is common to all the platforms.It gives a basic front layer after which we need to set up a layer which can interact with our native side.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
With all the common code being in common directory and native code in the platform specific directory, a cordova.js specific to each platform is then generated by the packager tool.It basically concatenates all the code in the common directory with the platform specific code to generate a cordova.&amp;lt;platform&amp;gt;.js files.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style="text-align: left;"&gt;
Lets dive into some more details.Our main function that communicates with native side lies in the exec.js file under the &amp;lt;platform&amp;gt; directory in src folder of cordova-js project.We have a function in exec.js named &amp;lt;platform&amp;gt;Exec that communicates with the native side. It has the following arguments : &lt;b&gt;success,fail,service,action,args&lt;/b&gt;. &lt;b&gt;success&lt;/b&gt; specifies the successhandler that is executed on successful execution of the call to native while &lt;b&gt;fail&lt;/b&gt;&amp;nbsp;denotes the errorhandler for the same.&lt;b&gt;Service&lt;/b&gt; specifies the class we need to call, for example to implement the call to the accelerometer to get the current acceleration we shall give a call out to the Accelerometer class.See the example &lt;a href="https://github.com/apache/cordova-plugin-device-motion/blob/master/www/accelerometer.js#L56"&gt;here&lt;/a&gt;.So the class to which the call is made is defined by the plugin itself.&lt;b&gt;action&lt;/b&gt; specifies the function called,like &lt;a href="https://github.com/apache/cordova-plugin-device-motion/blob/master/www/accelerometer.js#L56"&gt;here&lt;/a&gt;&amp;nbsp;the function &lt;u&gt;start&lt;/u&gt; is called for the class accelerometer with no arguments.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Also apart from exec.js we have a mandatory platform.js which is kind of a MANIFEST which specifies the details regarding the platform.&lt;br /&gt;
&lt;br /&gt;
So after joining the basic files of cordova and the code specific to the platform we have the cordova.js for the platform ready, &lt;a href="https://github.com/puneetgkaur/accelerometer_testWebActivity/blob/master/lib/cordova.js"&gt;here's &lt;/a&gt;sugar's basic implementation of cordova.js.&lt;br /&gt;
&lt;br /&gt;
cordova.js will basically help us to initiate a call to the native side of the platform using an exec function like &lt;a href="https://github.com/apache/cordova-plugin-device-motion/blob/master/www/accelerometer.js#L45"&gt;here&lt;/a&gt;&amp;nbsp;and handle the response through the success and error handlers passed as the first and the second arguments of the exec function.&lt;br /&gt;
&lt;br /&gt;
The minimal implementation of exec.js for sugar can be represented as follows :&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 18px;"&gt;&lt;div class="line" id="LC1125" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&lt;span class="kd" style="box-sizing: border-box; font-weight: bold;"&gt;var&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;cordova&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;require&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="s1" style="box-sizing: border-box; color: #dd1144;"&gt;'cordova'&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1126" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="nx" style="box-sizing: border-box;"&gt;utils&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;require&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="s1" style="box-sizing: border-box; color: #dd1144;"&gt;'cordova/utils'&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1127" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="nx" style="box-sizing: border-box;"&gt;base64&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;require&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="s1" style="box-sizing: border-box; color: #dd1144;"&gt;'cordova/base64'&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1128" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="nx" style="box-sizing: border-box;"&gt;bus&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;require&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="s1" style="box-sizing: border-box; color: #dd1144;"&gt;'cordova/sugar/bus'&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1160" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&lt;span class="nx" style="box-sizing: border-box;"&gt;bus&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;.&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;listen&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1162" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&lt;span class="kd" style="box-sizing: border-box; font-weight: bold;"&gt;function&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;sugarExec&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;success&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;,&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;fail&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;,&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;service&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;,&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;action&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;,&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;args&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;)&lt;/span&gt; &lt;span class="p" style="box-sizing: border-box;"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1165" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="k" style="box-sizing: border-box; font-weight: bold;"&gt;for&lt;/span&gt; &lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="kd" style="box-sizing: border-box; font-weight: bold;"&gt;var&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;i&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span class="mi" style="box-sizing: border-box; color: #009999;"&gt;0&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;;&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;i&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;args&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;.&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;length&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;;&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;i&lt;/span&gt;&lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;++&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;)&lt;/span&gt; &lt;span class="p" style="box-sizing: border-box;"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1166" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="k" style="box-sizing: border-box; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;utils&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;.&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;typeName&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;args&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;[&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;i&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;])&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;==&lt;/span&gt; &lt;span class="s1" style="box-sizing: border-box; color: #dd1144;"&gt;'ArrayBuffer'&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;)&lt;/span&gt; &lt;span class="p" style="box-sizing: border-box;"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1167" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="nx" style="box-sizing: border-box;"&gt;args&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;[&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;i&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;]&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;base64&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;.&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;fromArrayBuffer&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;args&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;[&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;i&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;]);&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1168" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="p" style="box-sizing: border-box;"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1169" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="p" style="box-sizing: border-box;"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1171" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="kd" style="box-sizing: border-box; font-weight: bold;"&gt;var&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;callbackId&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;service&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;+&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;cordova&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;.&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;callbackId&lt;/span&gt;&lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;++&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1172" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="nx" style="box-sizing: border-box;"&gt;argsJson&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;JSON&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;.&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;stringify&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;args&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1174" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="k" style="box-sizing: border-box; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;success&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;||&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;fail&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;)&lt;/span&gt; &lt;span class="p" style="box-sizing: border-box;"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1176" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="nx" style="box-sizing: border-box;"&gt;cordova&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;.&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;callbacks&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;[&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;callbackId&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;]&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span class="p" style="box-sizing: border-box;"&gt;{&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;success&lt;/span&gt;&lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;:&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;success&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;,&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;fail&lt;/span&gt;&lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;:&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;fail&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;};&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1177" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="p" style="box-sizing: border-box;"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1190" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&lt;span class="kd" style="box-sizing: border-box; font-weight: bold;"&gt;function&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;onResponseReceived&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;error&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;,&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;result&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;)&lt;/span&gt; &lt;span class="p" style="box-sizing: border-box;"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1197" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&lt;span class="k" style="box-sizing: border-box; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;!&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;error&lt;/span&gt; &lt;span class="p" style="box-sizing: border-box;"&gt;)&lt;/span&gt; &lt;span class="p" style="box-sizing: border-box;"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1200" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&lt;span class="nx" style="box-sizing: border-box;"&gt;cordova&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;.&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;callbackSuccess&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;callbackId&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;,&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;result&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1203" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&lt;span class="p" style="box-sizing: border-box;"&gt;}&lt;/span&gt; &lt;span class="k" style="box-sizing: border-box; font-weight: bold;"&gt;else&lt;/span&gt; &lt;span class="p" style="box-sizing: border-box;"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1204" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&lt;span class="nx" style="box-sizing: border-box;"&gt;console&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;.&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;log&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="s2" style="box-sizing: border-box; color: #dd1144;"&gt;"Its error"&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1205" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&lt;span class="nx" style="box-sizing: border-box;"&gt;cordova&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;.&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;callbackError&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;callbackId&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;,&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;error&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1207" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&lt;span class="p" style="box-sizing: border-box;"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1208" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&lt;span class="p" style="box-sizing: border-box;"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1210" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&amp;nbsp; &lt;span class="nx" style="box-sizing: border-box;"&gt;bus&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;.&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;sendMessage&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;(&lt;/span&gt;&lt;span class="s2" style="box-sizing: border-box; color: #dd1144;"&gt;"activity.cordova"&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;,[&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;service&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;,&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;action&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;,&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;args&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;],&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;onResponseReceived&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1212" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&lt;span class="p" style="box-sizing: border-box;"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class="line" id="LC1215" style="box-sizing: border-box; height: 18px; padding-left: 10px;"&gt;
&lt;span class="nx" style="box-sizing: border-box;"&gt;module&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;.&lt;/span&gt;&lt;span class="nx" style="box-sizing: border-box;"&gt;exports&lt;/span&gt; &lt;span class="o" style="box-sizing: border-box; font-weight: bold;"&gt;=&lt;/span&gt; &lt;span class="nx" style="box-sizing: border-box;"&gt;sugarExec&lt;/span&gt;&lt;span class="p" style="box-sizing: border-box;"&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/pre&gt;
&lt;div style="text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
To enable cordova.js to communicate with the native environment we need the help of bus and env.js files from the sugar web framework.&lt;br /&gt;
&lt;br /&gt;
As the format in which a module is defined in cordova is different from the sugar web framework one , we need to find out a way to keep both the files at single place and generate the other set from a single copy of the files.This task has been put into the TODO list as of now.&lt;br /&gt;
&lt;br /&gt;
As a result of playing around with the cordova framework inside sugar , we have been able to achieve the following results :&lt;br /&gt;
&lt;br /&gt;
1. We are able to communicate with the native environment using cordova api's.So that means a call to cordova exec function would now work inside a sugar web activity and respond back with the appropriate result&lt;br /&gt;
&lt;br /&gt;
2.Able to integrate the common cordova.js in the sugar framework.&lt;br /&gt;
&lt;br /&gt;
3.Integrate the accelerometer plugin.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://sugarcordova.blogspot.com/2014/05/the-first-steps.html</link><author>noreply@blogger.com (Puneet Kaur)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4438803281552454032.post-5145644689501720918</guid><pubDate>Fri, 25 Apr 2014 10:59:00 +0000</pubDate><atom:updated>2014-04-25T04:04:21.969-07:00</atom:updated><title>Sugar says hello to cordova ;-)</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Sugar labs - award-winning Sugar Learning Platform has been around for years now creating wonders in lives of many little ones and young, providing them with a window to a new world to explore new things. This fabulous open source community consists of some really cool and hard working people at the back end, thinking continuously about as to how to make sugar better than ever before.So here props up another idea.. why not make a cordova framework for sugar platform as android, windows and ios have ?? The obvious question that now arises in someone's mind who isnt yet familiar with cordova or phonegap would be - how is that gonna help sugar ? Well, the answer is pretty simple.All the activities and the code for sugar is currently in python because thats the language the software was made in.With cordova, all the web developers can make activities in html,css and js while not bothering about interaction with the physical hardware devices like camera etc.. the cordova wrapper would do that for you.Here's a small video explaining what phonegap/cordova is.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/wOH4aGows40?feature=player_embedded' frameborder='0'&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The cordova framework from sugar idea comes from the consistent development that has been done on the sugar web frontier which helps us to run web activities in sugar seamlessly using API in between which enable communication between python and javascript.You can check more about sugar web and its underlying architecture &lt;a href="http://here./"&gt;here.&lt;/a&gt;On similar yet a different front we wish to design the cordova framework.&lt;br /&gt;
&lt;br /&gt;
Here's a simple view of how we want our cordova framework to look like. Though we might need to modify a bit here and there as we proceed but the basic architecture would be the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://wiki.sugarlabs.org/images/0/01/Sugar_cordova_architecture.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://wiki.sugarlabs.org/images/0/01/Sugar_cordova_architecture.jpg" height="480" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
For the initial tasks of the project, we have decided to first build on the basic layer of cordova through which we can compile and get a basic sugar web template running. Once thats through, we can then add plugins.&lt;/div&gt;
</description><link>http://sugarcordova.blogspot.com/2014/04/sugar-says-hello-to-cordova.html</link><author>noreply@blogger.com (Puneet Kaur)</author><thr:total>0</thr:total></item></channel></rss>