Thanks peli - My bad, should have calculated that the limit is
practically unreachable - (but always had a feeling what if.....
sometimes too logical thinking is bad :) )
Anyways, in that case the above solution is full proof & good to go. I
have already implemented & it works smooth for Contacts, SMS & Media.

Hope it helps someone!

Thanks,
Shibbs

On Jun 23, 5:18 pm, Peli <[email protected]> wrote:
> Don't worry about reaching the limit 9223372036854775807.
>
> Even if you insert 1000 new entries per second into your database, it
> will take you 290 million years until you reach that limit
> ( 9223372036854775807 / 1000 / 60 / 60 / 24 / 365 = 292 471 209 )
>
> (dinosaurs died out 65 million years ago; the G1 would be a fossil by
> that 
> time:http://news.softpedia.com/news/The-Oldest-Fossil-Russian-Doll-290-Mil...
> )
>
> Peliwww.openintents.orgwww.openintents.biz/obscura.html
>
> On Jun 23, 9:45 am, Shibbs <[email protected]> wrote:
>
> > 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to