Hi All, >From the past two days I have been closely reading through the ContentObserver discussion on the various scenarios like: 1.) SMS sent 2.) Contacts updated 3.) Media added. 4.) etc...
We all are aware that the onChange() of the ContentObserver() doesn't notify us to what has been changed for obvious reasons. We thought of coming up with a logic, though it is not fully proof, just wanted to discuss the solution with you guys: The scenarios we deal with here are: 1.) Last SMS Sent 2.) New Contacts added. We had a close look at the db structure of the Contacts, SMS & Media. They all have this primary column name - "_id" which is autoincremental. Currently the limit of this stands at a whoofing: 9223372036854775807. (2^63) each time a new contact has been added to contacts.db or new SMS sent (record added to ( SMS db)) it is bound to have the greatest "_id" value if the above limit (9223372036854775807) has not been reached yet. Then in onChange() 1.) Filter out if the event is a new contact changed or SMS sent { simple logic posted in previous some post) 2.) If yes, then query and get the last record based on the ascending order of "_id" value (default order) you can get the desired last SMS sent or New contact added. Note: This logic is not full proof, cause over a period of time if the "_id" crosses 9223372036854775807, then this logic would fail or I guess so. Not sure what Android would do internally once the id crosses 9223372036854775807? Will it start from -9223372036854775808. Any better solution? Thanks, Shibbs --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---