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.