Saturday, October 17, 2009

How to delete all contacts from an Android phone?

When we started developing a cross-platform 'Contacts Sync' app, we found that in Android there is no way to do it straight. I was quite skeptical that a feature like that was not available :-)

Anyway, we wrote an app, intuitively called "Delete All Contacts" :P and started using it. The code is pretty trivial (if you can see a couple of posts earlier "Contacts in Android")

However, we added some jazz (like our logo) and a feature to delete contacts with a particular name / pattern. (My Beceem friends would fondly remember the set of commands I created in a debug tool called swin that let us read / write variables with a particular pattern in the name)

To download this app, just right-click here and save the android package. Then use 'Apps Installer' or adb to install the program.


Wednesday, October 7, 2009

Google does not have Search

Yes, Google does not have have Search.

At least, I did not find one in Android Market place. How much ever I squinted my eyes and searched, I couldn't find a single button that said search in that website. I do agree that the number of apps in Android is limited - But, that doesn't mean you shouldn't give a search button!

I had to scroll over all the items that were listed, and I still couldn't find what I wanted - However, we are able to locate the app when we search using our HTC Hero Android phone.

Thumbs down, Google!

Sunday, August 2, 2009

Contacts in Android

Working with Contacts (PIM) in Android doesn't seem to be straightforward as in Java ME. Looks like Android has a taken a 'database like' approach.

For e.g., there is no way to delete all the contacts in the phone! To do this we wrote a simple application which does the following:


mContentResolver = this.getContentResolver();



int contactsDeleted = mContentResolver.delete(Contacts.People.CONTENT_URI, null, null);

To delete a contact with a particular field (say name), use the following statement:


mContentResolver.delete(Contacts.People.CONTENT_URI,
Contacts.People.NAME + "=?",
new String[] {"Sriram V Iyer"} );

The first argument is the URI (which happens to be People in this case), the second argument is like a database WHERE query (without the WHERE keyword) and the third argument is the values (string array) that fills the content of the query.

To remove a contact with a particular phone number, use this as second argument:
Contacts.People.NUMBER + "?="


Wednesday, January 14, 2009

Technology Page

I started my blog Sriram V Iyer's Page to write about programming and software - The first few posts were related to programming too. However, as time passed, the blog's entries turned towards my interests that were not related to programming - Physics, gadgets etc. 

I was told that blogs should generally have a theme - The theme of my previous blog was 'Me'. But, I felt that I would do good to move away from posting serious programming stuff in that page. So,  I thought that I'll create a new blog that focusses purely on programming and computer science. 

You'll see more posts soon - I am working on some serious programming stuff these days :-)