rss
twitter
    Find out what I'm doing, Follow Me :)

Monday, February 27, 2012

Designing and Developing an Android app

Its been a very long time since my last blog post. I have been held up with multiple things and now I got the mind to write a post about my experience with Android application development.

Android needs no introduction. Every one of two smartphones used nowadays are powered by android(In India at least).There are lot of apps in the android market, many of which are just awesome. My desire to write Android app dates back to 2010 when I was in final year of Engineering, there had been many starts, but stopped abruptly due to various reasons(laziness being one of the main reasonSmile with tongue out). This time I started and I was able do a considerable part of application.

App Name FullScreen Photo Caller ID
Idea Rip off from here.
Motivation The free version of the above app can be used to set contact pictures for up to 5 users. And the paid version costs around Rs.250 which is very high and I’m sure very less people will buy. So, I thought to write an app an provide for free.

Thought the app I wrote is having very less capabilities compared to the above one, but  provides the important one, displays a full screen photo when a contact calls. So in this post I am going to explain how I went about developing this application.

Idea is simple, a corresponding picture should be displayed in full screen when a contact calls. Many things were to be considered in the design stage:

  1. To start my application when a call event takes place.
  2. To disable the default key guard in the phone.
  3. To allow user to select a picture for a contact.
  4. To display that particular picture while a call event takes place.
  5. Provide call accept and reject functionality (most tougher part).

I had very less idea on developing an application. But the android developers website along with the ADT plugin for eclipse make life easier for any app developer. Read this page for installing SDK, this for hello world tutorial and this for notepad tutorial. Notepad tutorial contains 3 examples, completing this will give us a better grip over Android fundamentals.

In android system, any class should extends the Activity class. Activity class maintains the state of the application, oncreate, onresume, onpause functions can be overridden in our application to the make the state of app sync across different events that takes place in android.

Now to the application I am writing. Point 1 written above can be done by extending a BroadcastReceiver class. It tells the state of the phone (ringing or idle, etc.)  and we can override the different functions to do corresponding work. Unlocking the keyguard can be done with the help of KeyguardManager class.

Point 3 and 4 are done writing an activity for storing the details in the database and displaying images by querying the database. Coming to the most difficult part according to me. Making the call accept and reject. Google doesn’t provide a direct method/API for attending or rejecting a call. I googled (as anybody does Open-mouthed smile), and found many ideas of implementing this. Everyone provided a round about way and I took one of the ideas, where an intent is sent to trigger button events and enable the headset programmatically and attend the call. Reject was far more worst. Google provided with less results and one implementation was to use a class that is only internal to android. One of the Samsung developers posted this on a blog which uses Java’s reflection and this is the only one method that will work (Requires MODIFY_PHONE_STATE permision). But this hack will not work in Android 2.3 and above because Google has made the MODIFY_PHONE_STATE permission is required unavailable for use by normal third party apps.

So the app I have written well for phones with Android < 2.2 (Tested with Samsung Galaxy Ace and Galaxy 3) for phones with 2.3 and above accept calls work (tested with Samsung Galaxy R and LG Optimus), for rejecting calls, just press back button when contact picture is displayed and then ordinary call even screen will be displayed.

Here are few screenshots from App. I will post the link for downloading app soon and also will post the code in code.google.com or github as open source so any one can contribute Smile.

FedererRajiniSachinSchumi

 

Thanks a lot for reading this. Please post your ideas and comments about my app and idea and this post below.

Thursday, July 7, 2011

Chrome Extension for Facebook notifications

Many of us are guilty of constantly switching back to Facebook to check for new Notifications. And if you’re like me, you’ve probably missed an important notification because you weren’t looking at your FB window when it came in. If you use Google Chrome, these days can be over since we just launched HTML5 desktop notifications which display pop-ups whenever a wall post or comment made in your FB account.
This is what Google wrote on their blog when they launched Desktop Notifications for Gmail and the same is being done by me(Smile with tongue out). We (Pragadeesh and I) have created a chrome extension that displays a popup whenever something happens in your Facebook.
Here are some screenshots of this extension we have developed. Download the extension in Chrome Web Store. Desktop Notifications
Install
POPup
You have to install and click the F icon next to the Omni bar in chrome. Then connect to Facebook by allowing access to our application. There ends you work, we will take care of displaying your notifications as and when they arrive in your accountSmile.

You may ask, why only chrome, this is because only chrome has developed this HTML5 feature and no other browser currently support it. Here is the w3c doc for it. Other reasons are Chrome’s Extensions  are very easy to create. Just HTML and JS. No need of C or C++ or any other weirder language like XUL(This is needed to create plugins for FF).
Please give suggestions and feedback on this extension. We are trying our best to make it as usable as possible. If you want to tell something related to this, please leave a comment here or mail to my id naveen.cse.csg@gmail.com.  And this is the Facebook Page.
P.S. We paid $6 as a developer fee to Google Chrome’s web store.
..Till Next time.

Saturday, June 25, 2011

Next Post : Facebook Notifications

Hi Guys,
            My next post will be on Desktop popups for Facebook Notifications in Google Chrome. Its a Google Chrome extension we have developed for getting the Facebook's notifications as HTML5 desktop notifications(Yes you are absolutely right in thinking this, its the same as what Gmail does when new mail arrives).


 Stay tuned for my next post for extension and other details.

Friday, March 11, 2011

Do You Know Series: Part 1

Its been more than 10 months since I had blogged and this post will be a start for DYK series. This involves facts, trivia, useful information from Technology, Software, Programming, Sports, Internet etc. If you already know any of these stuffs, kindly ignore it, others enjoy and learn . Smile. This is Part one of series and I hope many will follow.
1) Lets start with Google Chrome. We all know about Instant search in www.google.com. How many of you know how to invoke it from Chrome’s Omni bar ?? There is a simple way to do (Idea Courtesy: Internet).
  • Download and install Google Chrome dev channel. If you have previously pin the Chrome icon to your taskbar, unpin it.
  • Go to “Start -> All Programs -> Google Chrome“. Right click on the Google Chrome entry and select Properties.
  • Enter “--enable-match-preview” at the end of the shortcut target. Click Ok.
  • Launch chrome now and you will be able to see instant search results as you type. Such an easy thing to do.
2) The second thing I am going to tell is about the usage of operator “==”. The use of this operator is very easy and it may also lead to problems when you use it with strings. ‘==’ doesn’t work well with the strings always in most of the languages like C, PHP etc. Here is an example,
#include<stdio.h>
int main()
{
char a[10]="Hello",b[10]="Hello";
if(a==b)
printf("The strings are equal");
else
printf("The strings are not equal");
return 0;
}


On running the above program, we will get that strings are not equal. This is a very small example and when used in a large or a sufficiently large program leads to bizarre results. So better use strcmp method or equivalent in that programming language in which you code. (I remember studying this in C books, but recently when I had to do some comparison, used == and faced issues. So writing it so that it will be like a brush up of basic stuffs in languages.)

3) The next thing is about an Android App I recently came across and using it quite well. SmSpopup it is. This is an App that intercepts the incoming messages and displays in a pop up box on the phone and it works even when the screen is locked. One can also reply to the message via the same popup(see in screenshots, voice input also included). This is the fastest way of sending and receiving messages and when your Android’s default messaging system is slower(just as mine), this is *the* app for you.
The best part of this is, it is Open Source.

Screens have been taken from project’s Google code website. It is fully customizable and has plenty of settings to tweak and play with.

screenshot1 (1)screenshot2screenshot3screenshot4screenshot5screenshot6



4) The next DYK is regarding another OSS, Notepad++. For those who needs to use Windows in office and those who like it(Smile with tongue out, there will be very less ppl.. But W7 has wonders and we will have an argument about it at a later time).

There are multiple features in this software and it is fully loaded with many plugins one needs to use. Some of these are
  • The compare plugin – A simple button click to compare two files.
  • Column wise selection – Select by clicking Alt+Left mouse button. you can easily select columns.
  • The good one I think is Bookmarking a line. You can bookmark any number of lines and can perform various editing operations. This would be mostly useful in bulk text files where selecting a line and click find. In the Find dialog box, check mark line and press the Find all button. This will bookmark all the lines matching. Then we can delete or cut, copy paste, invert , toggle etc. Here is a screen for it.

Capture


5) Fifth thing looks a bit of techie stuff(Open-mouthed smile), but very easy to understand. You would have heard about Jquery, a JS library which is used for Rapid web development. There are infinite modules with jquery which one can use easily in the websites we design. This DYK is based on my experience, where I am using two jquery modules in a single webpage and one didn’t work properly. I had to Google to find the mistake I was doing- Initialising the class of the jquery twice. Each module comes up with a different version of jquery.js to include. I had included both the js files. What was happening is the second time one includes it, the whole jQuery object gets updated and over writes the plugin you already initiated. So ensure that, you include only one js file of the plugins.

6) The final thing in this part is about shell programming. When you are writing shell scripts, often errors may occur and easiest way to debug those is by use of “bash -x” for running the script. This will tell where the exact error is. Another way of doing this is by including “#!/bin/bash -xv” as the first line of script. Many such tips for debugging are provided in this website(http://www.cyberciti.biz/tips/debugging-shell-script.html).

That’s all for this post folks. If you find any mistakes or have suggestions do mail me or leave a comment and I will look into it. Till next time., –Naveen DS

Friday, May 28, 2010

Tech Event conducted at Abacus 2010

Hello friends,

Back again after a month to another blog post. This post is about the event conducted by our class students(CSE H Batch) at Abacus, National Level Technical symposium organised by Dept. of Computer Science, CEG.

Event’s Name selected was “:P”, for no reason. But the contest was not meant to be that. The questions were about Microsoft, Windows, Linux, Google, Internet etc. There were around 100 teams participating and we had some tough time evaluating the answers.

This is the link to PowerPoint presentation we had displayed. And if you need answers, do comment here or mail me, I'll send to you, since displaying them here will not be that good. http://www.4shared.com/dir/gakBnshJ/sharing.html

The first round went on for about 40 mins and response was very good. While evaluating we found some answers to be very humorous (and funny) that,  many of us were completely
roflol -ing(:P). 

For example, question  3’s  one of the answers was, Lindsay Lohan is torvald’s wife.(Man!! how can it be .. ??). The Ultimate one was for question 10 where one team wrote “Alt+F9”.. (Get out of the Turbo C  world dudes..). We selected 6 finalists and there were answers which suggested that Google was used to find them, but no one cant stop the curiosity.

Second round was hands on(participants were given a lap top), where challenges were given and participants were asked to finish them and get the points assigned. The link above has the questions. This round went on for about 1.5 hours. Some of the questions were damn easy and others were very tough that one cant crack without googling, but we didn't give access to internet. Winners were selected based on the number of questions answered and the weightage to them.

Overall, the event was one of its kind at this year’s Abacus and I would like to thank all my classmates who helped to conduct this event and Abacus team for  making this event a grand success.

P.S: Questions were chosen by Arun.B(arun04ceg@gmail.com), myself(naveen.cse.csg@gmail.com) and Sanath Kumar(dayanandasaraswati@gmail.com).

Thursday, April 29, 2010

Virtualization- Run any Operating System on your Machine

Hi Friends,

    Its been a month since my last blog post. I wasn't able to write due to various works I had in my college. In this post I am going to tell about running an OS(operating system) within another OS.

Most of us will have an eager to see how a newly released operating system will be looking like and what are the new features available or some of us will need to install some other OS other than what is in our system for some project work or for learning purposes and some of us will not be having enough hardware specifications to run a new OS. In these cases virtualization comes to our help.

There are many softwares available now a days to run an OS above another one, like VMWare, Virtualbox from sun(Now Oracle) etc. All are equal in functionalities and capabilities. I am going to explain how to install XP using Virtual Box(Box installed in Linux).

The most exciting part is that Virtual Box supports many Host and Guest Operating Systems. For eg. one can install Windows 7 over Linux (or windows of course) or install Linux(any possible Distros) over Windows(or Linux).

The various steps in doing it are below.,

1. Installing Virtual Box

Download Virtual Box from Virtual Box’s website.

Windows users can download the executable from here :
http://download.virtualbox.org/virtualbox/3.1.6/VirtualBox-3.1.6-59338-Win.exe

Linux users can select executable depending on your Distro from this page:
http://www.virtualbox.org/wiki/Linux_Downloads
It can also be installed through package managers or “apt-get”

and Mac OS X users can download the executable from here:
http://download.virtualbox.org/virtualbox/3.1.6/VirtualBox-3.1.6-59351-OSX.dmg

Windows users can just double click the executable and install.
Linux users’ installation depends on the type of file you download. If you are an Ubuntu User, I suggest you to download .deb file from the link above and just double click.
I don't have a Mac, but I think that the installation and the other features are same.

2. Configuring the Virtual box to install the Guest Operating systems.

Step 1: Starting Virtual Box.

  • Windows Users can see in the Start Menu
  • Linux users can find it in Applications->System tools

After the Virtual Box is started it looks like this..

Screenshot-Sun VirtualBox

You can see that I already have Windows 7 installed in the Virtual Box. “seven” indicates that.

Step 2: Creating a new Machine

Click on “New” button to create a new Machine, a new window appears.

1Screenshot-Create New Virtual Machine

Click the next button.

Step 3: Selecting Operating System

In the next screen select the OS you want as guest(That you want to install), in the next drop down select the version of OS (Distro also).

3Screenshot-Create New Virtual Machine

4Screenshot-Create New Virtual Machine

 

Step 4: Setting the RAM (to be used by the guest OS)

Set the amount of RAM you need to give to the Guest OS. Of course it can be higher than that is available and also when you give more than half the size of your available RAM virtual box throws warnings.

5Screenshot-Create New Virtual Machine

Step 5: Settings for Hard Disk size, allocation and location

The Screen below asks whether to create a new Virtual Hard Disk or use an existing one. Its better to create a new one. So selecting that option should be done.

6Screenshot-Create New Virtual Machine

In the screen below select the dynamic storage, so the memory in your Hard disk will be used whenever required. In the consequent screen give a name for your Guest and also specify the size of Hard disk you need to give to guest. I have allocated 4 GB for my guest.

7Screenshot-Create New Virtual Disk

8Screenshot-Create New Virtual Disk

Step 6: Confirmation

All the settings will be shown and just click on the Finish Button.(you would have to press finish in two screens that follow).

10Screenshot-Create New Virtual Machine

 

3. Installing Operating System

Now that all the settings have been set, you you need the specify the iso from which installation should take place.

11Screenshot-Sun VirtualBox-1

In this screen you can see that a new space for new OS has been created. Now click on the settings of that OS, screen below is displayed.

12Screenshot-Windows XP - Settings

Select ISO image file and select Xp’s iso (by giving the location of the ISO File).

After that select Ok and click on Start or right click on the OS’s option and click start. It should come like this.

14

The procedure for installing is the same as you do in normal case. After installing XP in virtual box it looked like this (:P). This is run inside Box.

winxppro

After installing it works like a normal Operating systems and you can use it easily.

I have also installed windows 7 in Virtual Box(in ubuntu) and it looks like this..

16

 

There is another way to install the OS if you have a friend already installed guest in his/her system. There is a format called as Open Virtualization Format(OVF) and you can get a ovf image from one of your friends or from another machine where guest is installed. There is an export feature and ovf gets created.

And in your system select import and selecting the ovf file will just import. Work done(:D) easily. No need to install over it again .. :)

Though this post looks long, its filled with lot of screens and an easy installation manual(like).

If you feel anything about my post drop in your comments and if you have any doubts in installing or using the Virtual box or any other related software also just drop in your comments, will reply you in very less time. If you generally like my blog, follow it or follow on Twitter at www.twitter.com/dsnaveen

Saturday, March 20, 2010

Add-ons one should have with Firefox [Updated]

Add-ons one should have with clip_image002 clip_image004
This post was actually written for CEGLUG’s magazine TUX, I am sharing for my blog readers.                            
In this post I'm going to tell about the most useful Add-ons or extensions that can be used with Firefox Web Browser, varying from Web Development to Entertainment. Let me start with most known and used add-on Firebug.

Firebug:
            clip_image006Firebug allows us to edit, debug, monitor HTML, CSS and JavaScript live in any web page. You are seeing a site and say "wow", how this has been coded? There is always Ctrl+U to show the source code. But it’s very difficult to find some parts in a big web page. For this Firebug offers "Inspect", with which you can just move the mouse over a part of page or a frame or an image, it will show the source code in a window. This is one of the cool features Firebug provides.
                The other things that can be done are:
        Tweak CSS to perfection- means we can just change code then and there and see the effect of change dynamically reflected in the webpage.
        Visualize CSS metrics- Firebug will be our eyes and it will measure and illustrate all the offsets, margins, borders, padding, and sizes for us.
        Monitor network activity- To see how much time is taken to retrieve an Element in webpage.
        Explore the DOM- Firebug helps us find DOM objects quickly and then edit them on the fly.
        Quickly find errors- Firebug marks error in a page with a red cross and gives a detailed information of that error.        
             
           
Chickenfoot:
clip_image008   The next add-on we will see is Chickenfoot. Chickenfoot is a Firefox extension that puts a programming environment in the browser's sidebar so you can write scripts to manipulate web pages and automate web browsing. In Chickenfoot, scripts are written in a superset of JavaScript that includes special functions specific to web tasks.
For example, lets type go("google.com") and press Alt+R to run the script. Google.com will be loaded. Now if you give as remove("advanced search link") and run the script, the advanced search link will be removed from your page. Isn’t it great? Yes, it also offers various other JavaScript editing tools.


DataFox:
 clip_image010Next is DataFox. This is a Bandwidth usage finder for Dataone Broadband users. It takes hell lot of time to login to the dataone site and check for our usage. Most of the times (in my case it happened) website tells “Time Out” and ask us to login again. This is when I searched for an add-on and ended up in this. DataFox is a bandwidth usage monitor for BSNL’s DataOne and MTNL’s TriBand broadband services. It gives us with lot of preferences that will help us to use it more effectively. One preference I have enabled is that "Update on Start Up", so that every time I open browser, DataFox will display my usage, so that I can manage the available resources well J.

ColorZilla:

            clip_image012This is a cool add-on that gives you the HTML code and RGB code of any color you can see on your browser. Very handy for those designing interfaces. The other features are Online Palette Viewer, Allows viewing, bookmarking and sharing any color palette, provides a permalink URL that represents any set of colors, online Eyedropper shows colors in RGB, HSV and additional formats.

Live HTTP Headers:  
             clip_image014Live HTTP Headers is an add-on that helps us to view the http headers in real time (i.e., while the page is downloading). It helps us to see which kind of web server the remote site is using, see the cookies sent by remote site etc.

ChatZilla:
                        clip_image016ChatZilla provides the features of an IRC Client from your browser. This add-on allows us to use many chat rooms, easy for searching rooms on a particular topic and supports logging and file transfers too. IRC is particularly useful for Open Source Geeks who like to contribute by fixing the bugs and writing new add-ons for the available softwares.
Adblock Plus:

                        clip_image018Ever been annoyed by all those ads and banners on the internet that often take longer to download than everything else on the page? Install Adblock Plus now you can get rid of them. Yes, Adblock blocks ads, applets, flash, embedded-media etc. If you find something annoying in a webpage that is not blocked, just Right-Click on that part of page and just choose “Adblock”. It will not be downloaded again.

iMacros:
                        clip_image020iMacros is very similar to Chicken foot, but without the extensive JavaScript. If you want to automate something with JavaScript (and use the JS DOM) – use ChickenFoot, if you want to automate something graphically – use iMacros Record and replay repetitious work. Anything from filling out forms, remembering passwords, testing forms etc.
           A great time saver for those using badly coded websites, which reloads the form again when we have submitted with some kind of error in input. Just press Record and fill the form. If form reloads again empty saying “Time-Out” or an error, just press Replay Button. Your form will be filled in automatically.

Text Link:
                        clip_image022This small add-on allows to double-click on an URI that’s not been linked. Without this extension, when you discover an URI text not linked, like "http://www.ceglug.org/ you just have to Double-click on the URI text rather than copy-paste or drag-drop. Then, Firefox loads it. It saves lot of time.
Moonlight:
                        clip_image024Next time you see a website telling “Download Silverlight for better functioning” and you use Firefox ( I don’t think you would be using IE .. :P), just download Moonlight which is an open source implementation of Microsoft Silverlight for Linux systems. This supports moon-shine media player and also all the possible codecs.

Speed Dial:

                        clip_image026If you had used Opera Browser, you would have seen the speed dial feature. This Speed Dial is an add-on for our Firefox browser which provides direct access to most visited websites. But unlike the one in Opera this has more functionality like adding more dials than 25, and a lot of customizable features.
Updated.. 27-04-10
 
Echofon:
                  image Echofon is an excellent and an useful extension if one is ardent user of Twitter. Installing this adds an Icon into the status bar which shows updates in your tweets. It  notifies when your friend tweets and also gives a text box where in one can type their tweet.
 
Another feature that is most exciting is., when you see a link and you like to tweet it to your friends, that can be done in a single click.
 
Read It Later:
                  image This add-on allows one to save the pages you need to read later. Every link can be saved and you can view the pages later without any internet connection.This is not it, you can also sync saved pages between devices like your Iphone, Ipad, Android, or any other smartphone. (Sync between computers also possible).
 
Though there are many add-ons, these are some of the add-ons one must have with Firefox.
I hope this article would be useful to everybody. If you have any queries try googling or binging :D.
P.S: Thanks to Sanjeev for giving Ideas to write about the last two add ons.  :)