05-10-2013 08:52 AM - edited 05-10-2013 08:57 AM
We have an application that adds contacts from the native contact book to our application contact list for sharing actions etc.
When the application first launches it does a bulk sync with the native device contact list. Thereafter it adds a PIM listener to track any changes to native contact list and acts on it immediately inside our application.
There are cases however when a user subsequently adds a new email account, say gmail , and enables synchronization of contacts. Immediately thousands of events may be fired for new contact adds depending on how many entries the gmail account had. As our application is written to act on each event as it occurs, it kills the performance of the app and device as each of the contact added event requires some processing and a network hit on our side. 1000's of these hits back to back occur and this is not desirable.
How do people handled these kinds of scenarious?
We would like to batch up all these requests and handle then once - however for this we would need to detect when the end of the synchronization process has occurred.
We looked for a new contact list/group added event, so we are able to detect the begining of this process. However, there is no reliable way to detect the end of the contact book synchronizing event.
We found the following API that purports to do this, however we have not been able to use it to fire the requisite events and it is is not clear that if this OTA event is fired for the case of email address based contact book synchronization that occurs with gmail etc or if it is for something else.
Does anyone have any sample code that can show us how to handle the begin and end of a bulk contact book synchrnonization process ?
Other approaches, work around to handle this situation will be appreciated.
05-10-2013 11:44 AM
afaik the SyncEvents are something else, monitoring OTA sync of data stored in http://www.blackberry.com/developers/docs/7.1.0api
i don't think there is an API for what you want. Maybe you could queue events and check for the timestamp, if there don't come any new ones for a certain time you process them.
Quite a complicated solution with lots of overhead, though.