I develop the code for retrieving the type of event change & id of the contact item of the contact database.I have posted the code which i developed,
database= CContactDatabase::OpenL(); //open phonebook, which returns a pointer
TUint connectionid = database->ConnectionId();
event.iConnectionId = connectionid;
changenotifier = CContactChangeNotifier::NewL(*database,(MContactDbObserver*) observer);
TContactDbObserverEventType type = event.iType;
TContactItemId contactitemId = event.iContactId;
but it retrieving the type of the change event has 64 & contact item Id has zero.please tell me,what is the probelm with this code ,if anyboby worked with this ,please send me sample code.thanks in advance .
In order to make an application receive events about contact database changes, the MContactDbObserver base class must be inherited by a class that implements the notification, and HandleDatabaseEventL() virtual function of the base class must be implemented. The class defines only one virtual function, which is called by the system when a contact database event occurs.
class CMyContactApp : public McontactDbObserver
// any public data and functions
// override the virtual function from the base class
virtual void HandleDatabaseEventL(TContactDbObserverEvent aEvent);
I tried with the prototype which you posted,For ex, if i deleted the one contact details from the phone book of the nokia 7650.for that it has to retrieve the exact event & contact id ,but it is not retrieving.I have posted code which i did,it retrieving chunk values.please do the needful.
By looking your code I think you have misunderstood the way the change notifier works. The change notifier uses a callback object (observer), which is called by the system. After you have created CContactChangeNotifier object with a reference to the contact db observer as a parameter, the contact database calls the HandleDatabaseEventL() whenever a change occurs. You don't need to call it explicitly by yourself. You get the type of the change event and contact item Id from the parameter of the HandleDatabaseEventL() .
Thanks for the information.for example If i made changes in phone book of nokia 7650 ,it will automatically trap the corresponding event or not.I have created a new contact item or update or delete the contact item from the contact database,it has to trap the event automatically,but it has not happening why? please give suggestion .thanks in advance.
So, You have to implement an observer (MContactDbObserver) and register it using the CContactChangeNotifier, and you will get the events automatically. I just tested it with the emulator in a way I demonstrated in my first message and it should work.
You have to understand the asynchronous mechanism it uses.
Hello maokkone and sajithali
I am also developing the same kind of application which reads the contact database
and save it to the oracle server.I want to trap the events happening on a particular
contact card say First Name:maokkone Last Name:HHH Cell: 98080080 job: Nokia expert
if i am changing the cell field of ur contact card whether i will be able to know the event so
that i will only read a single card and save it to the database instead of read/saving all the contact
Maokone u have said in ur discussion that u have tested the code on emulator, can i get the same code,it will be
a great help for me for my application.
U have also told abt asynchronous mechanism what does that mean.It will be helpful if u
make it more clearer so that we can design our application according to that.