Skip navigation

So after 3 days of doing nothing but exploring and trying to get along with libabook and libebook APIs and how to deal with them using ctypes in python, I have to say that I failed this time. I did however find a work around. I did not notice how much bad my last working code was except today. I tried to optimize it a little bit and it worked flawlessly and loads immediately!

In the beginning I took the sender number of each message, opened the address book, searched for the number and returned it. The process took about 3 minutes for 175 contacts and about 200 msgs. Because looping over EContacts takes more time than looping over a normal List, I found it better to flip the process. Instead of trying to find the sender’s name from his number, I try to find the sender’s number inside messages from his contacts info. Meaning, instead of looping over the messages and fetch each sender’s name from address book, I loop over the address book and try to find for each contact his messages and stick his name to them.

The process might have sounded stupid a little but it works. I know it’s inefficient, especially when there is only a little number of messages and large number of contacts (miss ratio is highest) but if you think about it, a person with few messages most probably will not want to import them anyway.

I will try to test this with higher count of messages and see the result. Nevertheless, I will switch immediately to libabook or libebook APIs as soon as I find out how to use them to get what I want… in python.

Before: (called for each message)

for econtact in contacts:

		phones = econtact.get_property('phone')
		phoneList =
		while phoneList.has_next():
			currPhone = string_at(

			if currPhone == phoneNum:
				return econtact.get_name

After: (called only once)

for contact in contacts:

		phones = contact.get_property('phone')
		phoneList =

		while phoneList.has_next():
			currPhone = string_at(
			for msg in recvLst:
				if currPhone[-7:] == msg.fromNum[-7:]:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: