Abhi's Experiments

Its a place to write about my professional experience and experiments

Hacknight @ Multunus

We had a very successful hacknight here at multunus yesterday (Jan 25, 2013). This was our 5th or 6th hacknight. And why it is very successful because we could complete all the 3 applications which we planned to do. Last time our team couldn’t finish the app completely.

We started by 10:30 PM, and there were 8 participants. We came up with ideas and selected 3 out of them, 2 team with 3 members and one team with 2 members. The ideas were: 1. An obstacle detection app based on Arduino board [Akshay, Anup, Vimal] 2. A Chrome extension for broadcasting URL [Abhilash, Sandeep, Manoj] 3. Scrollee - an app which scrolls the content across the screens (Multiple monitors) [Midhun, Ernest]

So I form a pair with Sandeep to work on the BroadcastIt app. We came up with the tasks and spikes. We have selected node.js to implement the server part. We worked on the spikes and we were confident that it can be done. By 1:30 AM we have done with the basic app. That is the server part and client using the normal page. So we were able to show the demo of broadcasting URL to others. The next task was to integrate the client with the extension.

Then we faced the first problem, that is the extension is not able load the socket.io.js file. The chrome extension can load js files only from inside the package or from an external URL which is secured(https). We have tried to include the socket.io.js onside the extension package, that didn’t work. Then searched for socket.io cdn URLs. We found a cdn URL for socket.io, and that problem got fixed.

So almost done with the app. On click of the extension it will popup a small dialog with Broadcast button, on cllick of that will broadcast the current tab URL to all other browsers which installed this extension. When we have done with this it was around 2:30 AM. But then the next problem, the extension will work only when the popup is showing. When the popup is closed the extension can’t listen to the server event.

For chrome extension we can have background scripts and pages. We spend around 1 hr learning these and found a solution to fix this problem. We removed showing the popup and started running the script in background. So it will listen to the server in background. So now when we install the extension, it can broadcast the current tab URL to other browsers which are installed the extension. It was 4:30 AM.

Then we thought of extending the app by introducing channel, by adding options to the extension. The options page will ask the user to enter a channel, and the URL will broadcast only to those browsers who are selected the same channel. We were able to create the options page and saving the channel for a browser. But we couldn’t complete the broadcast only to the same channel browsers, because it was morning 6 Am and we had to create a final video of the demo.

So it was a very nice experience having successfully completing an app that we started with the idea, implementation and finally showing the demo. It was very fun too, we didn’t feel asleep at all. Once I get the demo videos link, I will add it here :) Here is the demo videos :)

comments...

WhoIsNext

WhoIsNext is an android application which helps us to keep in touch with friends and relatives. This application I started implementing when I faced a situation where I was thinking of to whom I want to make a call next. From my call log it is very difficult to check whom I haven’t contacted in the recent past and when I contacted them. And I searched in the Android market for an app which helps me to keep in touch with my friends. But I couldn’t find a simple one. So I created one WhoIsNext.

User can add contacts to this app and the app will sort the contacts based on the LAST_TIME_CONTACTED. So the app will show the contacts which are recently contacted on bottom, and contacts which the user hasn’t contacted recently will show up on top. Along with the contact name user can see when he contacted that person.

I am using the LAST_TIME_CONTACTED property of a contact to sort the contacts. But the problem is some of the Android devices don’t update this property. So this application won’t work in those devices for now. For more details visit this link.

So for the next version(1.1) I am planning to create a BroadcastReceiver which will update the LAST_TIME_CONTACTED property of the contact once a call ends. This will helps me to fix the problem without much rework. But there is one problem with this approach as both the device and the application uses the same property LAST_TIME_CONTACTED. If the device updates this property for SMS and email then the application can’t use this property as the application concentrates on calls.

In another version(1.2) I am planning to save the LAST_TIME_CONTACTED value to a custom variable. And update that using the BroadcastReceiver. In that way the application is not dependent on device specific properties.

You can check the source code of this application from my GitHub repo.

Update

I have implemented the BroadcastReceiver and storing the contact details to a file as part of the latest version(1.1). Now the app is independent of any phone specific features, so the latest version will work in any Android mobiles :)

comments...

Blackberry app using phonegap and jquery mobile

Last week I was working on a cross mobile application, which is developed to work on all the mobile platforms including Android, Blackberry, iPhone and Windows mobile. We developed the app using phonegap and jquery mobile, and it worked well in Android mobile. Then I moved on to Blackberry. In Blackberry it took sometime to setup the environment and run the application. Here I am going to explain the issues I faced and the steps I taken to fix the issues.

  1. Setting up environment

    We were using eclipse for developing Android application. So I thought to install eclipse plugin for Blackberry by following the instructions given in the phonegap wiki. And that didn’t work. Then I tried this link which is for BlackBerry OS 5.0 and higher. Here the instructions under the heading ‘Install the BlackBerry Web and WebWorks SDK Plug-ins for Eclipse’ won’t work because there is a small message in italics ‘End Of Life Notice: The BlackBerry WebWorks Plug-in will no longer be available for download as of Oct. 18, 2011. Support for the plug-in will be discontinued on Dec. 31, 2011’.

    So I stopped searching for an Eclipse plugin. I started setting up environment for the console. I setup Ant by following the instructions from the phonegap wiki. Then I downloaded and installed the webworks sdk from this link. So at last the Environment setup for console is ready.

  2. The commands to build, load simulator and load device

    In phonegap doc the commands to build the blackberry phonegap app from console is given as ‘ant build’. But this won’t work. Because for phonegap 1.3.0 it is ‘ant blackberry build’. Similarly for load the app in simulator ‘ant blackberry load-simulator’ and load app in device ‘ant blackberry load-device’.

  3. Code signing

    To load the app in device you have to sign the code using the key provided by Blackberry. You can order the keys from this link. It will take around 2 hours to process the request and get the keys. Now you have to install/register the keys using your webworks sdk. After installing the signing keys you can run ‘ant blackberry load-device’ to install the app in the device.

  4. Testing app in the device

    In the phonegap doc it is mentioned that the installed app will be available in the Downloads section of Blackberry. But I couldn’t find the installed app there. So I opened the app by searching in blackberry search.

  5. Back button in Blackberry exits the application

    In Android the back button loads the previous screen of the app. But in Blackberry if you press the back button it exits the app even if you have visited multiple pages. I fixed this issue by overriding the back button event click from the phonegap. The phonegap code for listening the back button click and show the history is given below:

      blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK, 
         function() { 
             history.back();
             return false;
         }); 
    
  6. jquery loading message breaks in blackberry

    We are showing the jquery mobile loading message while loading the data using ajax. But it is breaking in Blackberry. And I found this link which saying “It is apparently known and won’t be fixed on the current devices”. This one we didn’t fix. But we will do some work around like showing our own message or something else.

So this is the Blackberry phonegap experience I got from the last week. Hope this will help you to setup an environment for your Blackberry webworks app.

comments...