Tuesday, February 2, 2010

Where are You? featured in Gizmoji!

Our latest app "Where are you?" is now featured in Gizmoji! Check out a quick review!
http://www.gizmoji.com/gadgets/way-where-are-you-app-for-your-android-phone

Python S60 and contacts

I've been dabbling in and out with Python for S60 (EXCELLENT stuff) for programming Symbian mobiles - We have a couple of S60 phones - N85(Series 3, FP2) and 5800 ExpressMusic (Series 5)

In UMA, we have used Java ME and Java to manipulate the contacts in Symbian and Android phones. However, today we wanted to prototype some app, and we thought Python was the best way to go. (some people see vested interests in me doing this :D)

Looks like it is non-trivial to access contacts in Python. I'll quickly share what I learnt

ContactsDB is the database of contacts. This is obtained by calling open() function from contacts module.

>>> import contacts
>>> cdb = contacts.open()

By not giving any argument to open() we open the default contacts list (the one you want to manipulate most likely)

Now, to access contacts from the cdb, you can do the following

>>> ckeys = cdb.keys()
>>> for i in ckeys:
>>> c = ckeys[k]


Contacts are stored in ContactsDB like a dictionary of type - So, we can access each contact by using the ID which is obtained from cdb.keys()

Now, comes the question of accessing the fields inside a contact. For this, we need to understand how a Contact is constructed - It is constructed as a list of ContactField type. To access say first_name, do:

>>> names = c.find('first_name') #names is a list now
>>> name = names[0] # There is only one first name :D
>>> print name.value # This would print the first name

Make sure you check if len(names) > 0, because sometimes this field may not be present in the contact

find() returns the list of ContactField type. This is because, you can access mobile number by

>>> mobile_nos = c.find('mobile_number')
>>> for m in mobile_nos: print m.value

This would print the list of all mobile numbers for Contact - c. Just that the same interface is used for first name and last name.

More info on:
1. ContactsDB
2. Contact
3. ContactField

Btw, do you guys use the Bluetooth console from PC onto the Python on the phone - It is quite cool. Probably, I'll write a short note on how to get that going in my next post.

Monday, February 1, 2010

Where Are You?

Finally, we released 'Where Are You?' also called WAY in the Android Market. This is a cool app that can help you locate friends / family.

Basically, we need to launch the WAY app and keep it running. When you need to locate someone, you switch to this app, and identify the contact you need to locate. The other person should have authorized you to locate him/her.

WAY sends a command to the remote user as a text message. This app is based on a cross-platform command execution engine that can run on platforms including Google Android, Java ME / Symbian.

WAY should be running for the other user too. WAY in other Android phone understands the command and responds with the location if the requester is authorized.

So, there is no need to call and ask for the other person's location. Just use WAY!Or, as we call, Go To Way!

A detailed manual can be found here