Tag Archives: Android

A Better Android DatePicker Plug-in for Cordova

14 Apr

Cordova (previously PhoneGap) needs no introduction. It’s the best solution to deploy websites developed using HTML, CSS and Javascript as a native app over wide range of mobile devices. Certainly mobile app built using web technologies has it’s own share of advantages and disadvantages, but this is not up for discussion in this post.

I’ve searched quite a few times in past for a way to invoke native DatePicker on Android using Cordova or any of it’s plug-in. Finally, I found one over official PhoneGap Plugins page. For starter, it serves the need as it pops the DatePicker and allows developers to capture the date selected using DatePicker in Javascript.

But as I started using it, there’re following few features I found missing in this plugin, especially in case of newer Android OSes (> 4.0) –

  1. You cannot set Minimum and/or Maximum Date in DatePicker. So, if there’s specific need to have date range, this plugin certainly fails to provide proper solution. It happens on all Android OSes.
  2. On Android OS > 4.0, the DatePicker loses Cancel button. I checked and this issue is with Android ICS itself, but it would be nice to have that button just in case user don’t want to enter anything once DatePicker is popped open.
  3. Also on Android OS > 4.0, user is no really required to press done to set date. Any action performed like clicking hardware back, or clicking outside the DatePicker pop-up, results in selection of date. Again this is default feature to ICS versions but definitely it’s a bad User Experience.


I searched over various StackOverflow threads but none of them were able to solve these issues completely, though in parts some of the issues were solved. So, I decided to create my own plugin. Of course, I’ve taken the existing plugin and created my own. You can find revised plugin at my GitHub page.

I tried to address all the issues I listed above. Using this plugin is quite easy, just like any other Cordova plugins. Just follow the instructions in the readme.md file in the project or go through the following steps –

Step 1: Copy and Reference –

Just copy datePickerPlugin.js file to your ‘www’ folder. Create a package com.bikasv.plugins.datepicker and put DatePickerPlugin.java file into this package. Now update your res/xml/config.xml with following lines –

<plugin name="DatePickerPlugin" value="com.bikasv.plugins.datepicker.DatePickerPlugin"/>

Step 2: Invoke –

Call following function if you need DatePicker –

    function handleDates(elm, options) {
        var currentField = $(elm);
        var opts = options || {};
        var minVal = opts.min || 0;
        var maxVal = opts.max || 0;

        var myNewDate = Date.parse(currentField.val()) || new Date();
        if(typeof myNewDate === "number") {
            myNewDate = new Date (myNewDate);

            date : myNewDate,
            mode : 'date',
            minDate: Date.parse(minVal),
            maxDate: Date.parse(maxVal)
        }, function(returnDate) {
            if(returnDate !== "") {
                var newDate = new Date(returnDate);

And following for TimePicker –

    function handleTime(elm) {
        var currentField = $(elm);
        var time = currentField.val();
        var myNewTime = new Date();

        if(time) {
            myNewTime.setHours(time.substr(0, 2));
            myNewTime.setMinutes(time.substr(3, 2));
            date : myNewTime,
            mode : 'time'
        }, function(returnDate) {
            if(returnDate !== "") {
                var newDate = new Date(returnDate);


Step 3: Done –
Now you can see the result. A DatePicker with ability to set Minimum and Maximum date. See following screenshots as it appears on Android 4.0+ devices:
With Max Date With Min Date Time Picker

This plugin solves all three issues I’ve mentioned.

  1. You can set Minimum and Maximum date on DatePicker, and this works on all Android OSes.
  2. Cancel button is now present in DatePicker – something which is improvement over stock DatePicker.
  3. Clicking outside the DatePicker will do nothing, neither closes the pop-up nor update the date. Hardware Back button will not update the date as well. Again this is UX improvement over stock DatePicker.

Found any bugs or have any suggestions? Create an issue over GitHub issues page.

Project Link …


Take control of your Android – Tasker!

2 Aug

With my growing love towards great open world of Android and it’s being hard to cover them in one, I decided to start a blog series – Take control of Android. This series will primarily deal with the various tools and methods that helps to automate practically any task on Android. Also, there will be some tools discussed that will add ease of use and remote access to Android. Even if you happen to know a few things, I surely hope you’ll learn something new in this series.

Today, the app in discussion is Tasker – arguably best task automation tool available on Android platform. Tasker is not free though, and you’ve to shell out Rs. 346.94 to get your hands on it. But I must say, it’s totally worth it’s price and you won’t regret buying it.

Once downloaded and installed, you can create Profiles which contains Tasks to be automated. One example is shown below –

Now, although Tasker is automating tool and is supposed to do repeated task with ease, the app itself is not that easy to use. There is small, not much I assure you, learning curve associated with this app. So, let me walk you through Tasker by creating one simple automated task.

For our purpose, let’s create a task to send SMS when we create Missed Call from our Favorite contact. Remember, this task will only send the SMS when a call is missed by the person who is in your favorite contact list. For everyone else, no action will be performed. So, let’s get started.

Click + on Profiles menu and give it some name. A new window will pop up asking to select First Context. First context is the condition which will be satisfied to execute the task. In our case this is a missed call from favorite contact.

Now select State in the menu and then select Phone and finally Missed Call.

Now select favorite contacts, either by typing C:FAV or by using search icon above the text box. Click check mark, and you’ll be presented with Tasks screen.

Now click new task, and in next screen click + icon. You’ll now be presented with Action categories.

Choose Phone option here and scroll to bottom to select Send Sms option. Now type in the number of contact to whom SMS is to be sent, and the message and click the check mark. You’ll see the new Task created. Now click the check mark of this screen to have your profile configured.

Now, whenever you receive a missed call, the phone will automatically send the predefined text to the given contact.

You can add multiple tasks to the profile as well. Also, you can further customize the task by having Exit Task (task which will be performed once the main task is performed), moving the existing task to Exit Task, Change Task or Unlink Task. Just long press the task menu and you’ll get these options.

One of the coolest features of Tasker is the ability to export task in various formats, but the most promising being able to export them as an app. Just long press any of the task and select Export. Now select As App in next screen.

For app creation Tasker App Factory is required. If you haven’t installed it already, Tasker prompts you to install it. Also, the task must have an icon for this process to complete.

Once prerequisite is met, the export process will be started. Once the process finishes, the app will be ready and an icon will be shown, which on click, installs the new app.

This was just one example to simplify your life by automating the task, Taskers have many such arsenals under it’s belt. For example, for me, it automatically turns on the WiFi and disables the mobile internet when I reach home or the office. For rest of the places, it does the opposite.

Although, Tasker is very handy, very powerful and very versatile app, there’s a few gripes while using the app. I’d like you to know it before you spend your hard earned money on this app –

  • Tasker doesn’t catch the location with ease. So, the location based tasks may fail sometimes.
  • There are too many screens involved in creating single profile.
  • Corollary to above, developers might have provided with pre-defined profiles, those which are very commonly used.
  • Help should be bundled with the app rather than being online. Demo examples would be great.
  • Has a learning curve that can fend away novice users.

There are areas where Tasker shines compared to other automation apps (their review will come soon) –

  • Unlike some, Tasker is completely offline utility and doesn’t require external server to host tasks.
  • Already feature-rich Tasker, can further be enhanced with the help of plugins, which is abundant.
  • Memory usage of Tasker is quite less and doesn’t drain the battery much.

It’s clear that Tasker is quite powerful utility and it’s stated flaw is not as much as it’s benefits. But if you still want to have review of other similar tools before buying Tasker, I suggest you to check this blog in a while. I’ll covering a lot of automation tools.

Root any Android phone without hassle!

13 Jan

Android is really a fun mobile OS providing you the ability to customize it the way you like, or to install as many  app you want. But if you really want to take full advantage of the OS, you need to root the device. For those who don’t know, rooting is the method of getting root access (Android is Linux based after all) to the OS, or in other words it’s way to have full permission to practically do anything. Rooting also enable to install the apps which require to perform system level changes/access.

Now, as we know, rooting is powerful and more fun, question comes how we do it? And also if every mobile is rootable or not?

There are several versions of Android and every version is further customized by the mobile phone manufacturer to stand out. But this adds difficulty when it comes to rooting and most of the times the phone doesn’t root at all. And, if you’re not making something (rooting, in this case) you’re actually breaking it i.e. the phone can be rendered useless if not rooted properly. So, before you try, remember your warranty will completely void and you may end up with total plastic which do nothing.

Precautions out, and if you still dare, then here comes a very handy and comfortable tool to root the Android phones – Unlock Root. This is one stop solution to root practically any device running on Android OS version 2.1 (Eclair), 2.2 (Froyo), 2.3 (Gingerbread) and 4.0.x (Ice-cream sandwich). Some notable devices (some of which are pretty nasty to root as well) are HTC Wildfire S, HTC Desire S, Samsung Nexus S, Samsung Galaxy Nexus, etc.

Interested? Just follow these very easy to use steps to root your phone and to unlock the world of possibilities.

Go here to download Unlock Root. Install this and make sure that your device drivers are also installed.

1. Open the Unlock Root application. The main window will open like this –

Main Interface

Unlock Root main interface

2. Make sure that your device must be in USB Debugging Mode. If not then just go to Settings > Applications > Development and then selection the option of USB Debugging Mode.

3. Now once you connect your device to the PC, it’ll be automatically detected by Unlock Root program and a prompt will come just like this –

Device Detection

Device Detection

4. Now you’re presented with very easy to understand two options – Root (the BIG red button) and UnRoot (the other small button). Rooting will essentially install one Superuser.apk file which will in turn grant you full permission.

Root Device

One-click rooting of the device

5. Optionally (but highly recommended by Unlock Root people), you can install Power Saver tool as well to improve the battery life. This can also be done right from the same interface.

Power Saver

Install to extend battery life

6. Finally, you’re done! Now the application will require you to reboot your device and present you with this friendly message.


Reboot message

7. Done! Once rebooted your device will be properly unlocked. Enjoy the real freedom!

8. If, for some strange reasons, you want to unRoot your device, you can also do so with the Unlock Root application. Just connect your device and press that small little UnRoot button and you’re good to go.


Aakash – The World’s cheapest tablet is here!

5 Oct

Today Govt. on India has released it’s much awaited tablet, Aakash, at a highly subsidized price of Rs. 1400 for students (Rs. 3000 for common mass). It’s a 7 inch tablet, running on Android Froyo. Full specifications is given below.

  1. Screen Size : 7 Inches (18 Centimeters)
  2. Wi-Fi : Yes
  3. Media Player :Yes
  4. Battery Power : 180 minutes
  5. Operating System (OS) : Android 2.2 (Froyo)
  6. Video Conferencing : Yes
  7. USB Ports : Two
  8. Memory : 32 GB (expandable)
  9. RAM : 256 Mb (on lower side)
  10. CPU : 366 MHz

The tablet looks like this, which is quite similar to any Android tablet –

Aakash Tablet

It’s very ordinary configuration and the tablet looks like very basic device but considering the price tag of Rs. 1400 ( even Rs. 3000), it’s a steal deal. Although it runs on Froyo currently and doesn’t seems to be up-gradable

Aakash will be first distributed among students on India (first 1000 will be free, dunno the process of getting it though). Somewhere in next year one can expect a launch of this tablet to general public at the price tag of Rs 3000.

%d bloggers like this: