Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 13:29, 5 June 2008.

Getting Contact Database Change Event

From Forum Nokia Wiki

We can receive events about contact database changes in our application, the MContactDbObserver base class must be inherited and the virtual function HandleDatabaseEventL() must be implemented. This function is called when a contact database event occurs.

If you are not familiar with Observer Pattern, please refer to [Observer Section] on Wiki.

class CContactDatabaseObserver : public CBase, public MContactDbObserver
       {
 
 
public:
 
        CContactDatabaseObserver();
 
        // we need to override the virtual function from the base class //
 
        virtual void HandleDatabaseEventL( TContactDbObserverEvent  aEvent );
 
 
         };
 
 
// Handle contact database events //
 
void CContactDatabaseObserver::HandleDatabaseEventL(TContactDbObserverEvent 
 
aEvent)
         {
	     // Do Something
         } 
 
//We must also create the CContactChangeNotifier object to register itself to 
//receive events.
 
 
CContactDatabase* ContactDatabase = CContactDatabase::OpenL();
 
// Here iContactDatabaseObserver is a CContactDatabaseObserver pointer //
 
CContactChangeNotifier* DatabaseNotifier = 
CContactChangeNotifier::NewL(*ContactDatabase , this);// Changes by aamitgupta on date 5/06/2008
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX