Phonegap is not ready yet.

This may sound like not true, but actually Phonegap(Cordova) is not ready yet for the prime-time. The point is something or the other will always get in your way if you try to do a little more than basic UI.
It’s a pity to see that Phonegap has reached a version number of 3.3, still feels uncomfortable to work with.
While for a basic static page navigation it may be a solution to go for, for mobile, but think twice if the UI is becoming even a little more than basic.

A simple childbrowser (inAppBrowser) is failing in the current version and I found people are finding workarounds or solutions to fix this. So the point is not that its fixable but its not dependable.
Again, from version 3.0.0 on-wards, one need to have an internet connection to start building! Well, its NPM and NodeJS, I know, but its not comfortable at all rather confusing.

The best Phonegap version as I know is 2.8.0. Its the stable of all.
If at all you are trying to develop on Phonegap, stick to this version(2.8.0) until they release a stable version again.

Happy coding.

Social plugin for Phonegap 2.6 and up

In my search to have the iOS 6 default social sharing plugin, I landed up at this page. While everything seems right for this plugin, I somehow faced some problems in the UX. Thought would look a little deeper into it and found that this plugin relies upon the old plugin architecture of Phonegap. It still works, but then if it does not, you know know why.
Now to implement social sharing in my project, I have done a quick round of update to the plugin. Its working in my phonegap version 2.6. And that should work on Phonegap 3 as well, as the new plugin implementation has not changed after version 2.0.
Here is the github link for the new plugin.
While currently this plugin only shares the link and the message, you have to send a third parameter as an empty string for the image parameter. I will do the code cleanup and fix as I get some time to look into it. For the time being, its ready to use in new Phonegap versions.

Happy coding :)

A Record is now on Play store

Continuing with my Cordova ( Phonegap ) exploration, I pushed a new Android application to Google Play store.
splash
The application is to record audio. Start the application, press the record to start and press again to stop. You are done with recording and audio file is stored in your local file system.
The application is again a standalone application and does not require to connect to internet. So its private, secure, offline and yours.

As usual, its open-source and the source code is in github. Would love to listen back your take on the application.

Phonegap ( cordova ) and iOS longtap

This is perhaps the most significant effect of using a webview for iOS development. When working with Phonegap(cordova) which uses WebView, the user gets a longtap event as it use to on a web browser. All sort of long tap menus will come up in an application using Phonegap (ex : select, copy etc).
To suppress these unwanted menus on a native application, which uses Phonegap(Cordova), there are a number of options found throughout the internet, but the one which worked for me is a style declaration as below.

/* Disabling the default iOS bevaviour of copy-paste on long tap */
*:not(input):not(textarea) {
	-webkit-user-select: none; /* disable selection/Copy of UIWebView */
    -webkit-touch-callout: none; /* disable the IOS popup when long-press on a link */

}

Happy coding :)

Cordova(Phonegap), jQueryMobile and making a popup

This may seem obvious to make a pop-up with jQuerymobile with its popup API, but its a little more than just calling the api.
The problem is closing the popup. When working in a single page application in jQuerymobile and phonegap, the closing of the popup will take you to different jQueryMobile pages depending upon your setup.
The solution is to make the popup ready to be open just at the current page and while closing it should not make the application go to different pages. The trick is to while initialising the popup widget, initialise it with “{history: false}”, and thats all.
Here is a popup created with jQueryMobile API.

My PopUp

Title

Save Cancel

Here is the javascript code to initialise the widget and open it.

//making a popup which will not take you back to the previous page.
$('#popupDialog').popup({history: false});//awesomeness
$('#popupDialog').popup('open');

Happy coding :)

Cordova (Phonegap) , alert message.

This might seem, very easy task. But then while making a customisable alert message, one need to think as to how to do it. While working on Cordova(phonegap), one can easily assume and which is true is the javascript alert script.

alert("Hello!");

The javascript alert will work. Then we do not have a customisation option except for the message. The solution Cordova provides is a function with the name as alert. The syntax is as below.

navigator.notification.alert(message, alertCallback, [title], [buttonName]);

In the very basic form, where one need to have a specific title, message and button name, the code I use is

navigator.notification.alert("My message", undefined,"My Alert", "ok");

Thats the simplest kind and if one need more generic, wrap the whole thing inside one of your own custom function as example below.

function showAlertWithTitle(title,message){
	navigator.notification.alert(message, undefined,title, "ok");
}

Hope coding.