Friday, March 6, 2015

Hello all,

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.

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.

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.

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 !

An overview of how plugins are made :

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 : . So for example lets take up accelerometer to explain things, the code on javascript side lies here : do have a look into this file.

We define an object : with functions start, stop .

The communication to the native side happens through this line : and we pass the arguments "Acceleration" , "GetCurrentAcceleration" respectively

We recieved the parameters pasased through the javascript side on the native side through the function here :

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 :

So eventually our cordova accelerometer call lands us to the accelerometer code on the native side residing here :

The response is sent via this line : back to the javascript code.

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.

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  get in a new set of talented developers this time round too :-)

Incase of help dont hesitate to drop a mail at


  1. hi, do we have any discussion forum? Thanks

  2. Hi, we have a mailing list : Sugar-dev Devel and also we are on irc channel #sugar on Freenode, feel free to drop your messages on irc or on mailing list