×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    190

    Exclamation Contact deletion event

    I am following http://wiki.forum.nokia.com/index.ph...e_Change_Event to get the notification whenever a contact is deleted from the phone.

    Code:
    // Handle contact database events //
     
    void CContactDatabaseObserver::HandleDatabaseEventL(TContactDbObserverEvent 
     
    aEvent)
             {
    	    switch(aEvent.iType)
                {
                //if any contact deleted in phonebook
    	     case EContactDbObserverEventContactDeleted:
                    break;
                }
             }
    Now the problem is that I never get any information/detail for the contact that has been just deleted from contact database. For instance I use the below snippet to get the contact details:

    Code:
    	// Opens the default contact database           
    	iContactsDb = CContactDatabase::OpenL();
    
    	// Read contact using id
    	CContactItem* contact = iContactsDb->ReadContactL(aData);
    	CleanupStack::PushL(contact);
    
    	// Get a reference to the contact item's field set
    	CContactItemFieldSet& fieldSet = contact->CardFields();
    
    	// Read and display all fields
    	for (TInt j = 0; j < fieldSet.Count(); j++)
    		{
    			//THIS PART IS NEVER EXECUTED....
    		}
    Can anyone suggest the way to get the details of deleted contact..
    Last edited by say2paul; 2010-09-03 at 07:35.

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: Contact deletion event

    I think somebody else did also ask this few months ago, and if I remember right the conclusion was simple, basically since you get the event when the deletion has been done, you can not get anything from the database anymore when you are handling the event.

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    190

    Re: Contact deletion event

    Quote Originally Posted by symbianyucca View Post
    I think somebody else did also ask this few months ago, and if I remember right the conclusion was simple, basically since you get the event when the deletion has been done, you can not get anything from the database anymore when you are handling the event.
    I understand, but there has to be some way so that I can synchronize the native phonebook with the one I maintain online..

    The only way that I can see is the Contact ID i.e. I can send the contact ID to my Web Service at the time of contact deletion and the Web Service can check the corresponding contact and delete the same manually....

    I am still looking for a better way...

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: Contact deletion event

    Yep, I can not remember what information is given with teh event (haven't used the code for long time), anyway, as the device contacts database does not have the item anymore, you would need to then just find it from your owm database with the information you get from the event. Thus if you get the contact ID and you cna match it to the deleted one on your own server, then I suppose that's rather nice way on handlign teh situation.

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,570

    Re: Contact deletion event

    You have not described your use case.
    - if your application is always running, this is the simplest way: you capture deletion events, and send them immediately or just collect them for sending later as a batch
    - if your application is not an always running one, you can experiment with DeletedContactsLC (the method seems to be an existing one in the header, though the documentation just 'mentions' it), or via sending all contact ID-s, and let the server find out which ones are missing (=deleted)

  6. #6
    Registered User
    Join Date
    Jul 2005
    Posts
    190

    Re: Contact deletion event

    Quote Originally Posted by wizard_hu_ View Post
    You have not described your use case.
    - if your application is always running, this is the simplest way: you capture deletion events, and send them immediately or just collect them for sending later as a batch
    - if your application is not an always running one, you can experiment with DeletedContactsLC (the method seems to be an existing one in the header, though the documentation just 'mentions' it), or via sending all contact ID-s, and let the server find out which ones are missing (=deleted)
    Yes we may use any of the methods but can never get the details (name, number, etc) about the contact that is deleted..

    There is one use case where the app needs to send an SMS to a predefine number with the contact details of the contact that just got deleted, I guess there is no possible way to get through!

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,570

    Re: Contact deletion event

    Yes, for reliable implementation of such use case you will probably need to have your own "shadow" database.
    It is not that bad, since that database could have two columns, one for the contact ID, and the other could store pre-formatted messages which you can send immediately.

  8. #8
    Registered User
    Join Date
    Jul 2005
    Posts
    190

    Re: Contact deletion event

    Quote Originally Posted by wizard_hu_ View Post
    Yes, for reliable implementation of such use case you will probably need to have your own "shadow" database.
    It is not that bad, since that database could have two columns, one for the contact ID, and the other could store pre-formatted messages which you can send immediately.
    Yep, Absolutely!

Similar Threads

  1. Replies: 0
    Last Post: 2010-01-28, 06:47
  2. j2me - contact list and event list
    By chia_84 in forum Mobile Java General
    Replies: 4
    Last Post: 2008-11-13, 09:40
  3. Replies: 4
    Last Post: 2006-10-12, 09:56
  4. contact database change event details
    By rsajithali in forum Symbian
    Replies: 9
    Last Post: 2004-08-17, 00:55
  5. Notification on contact deletion
    By jogdandyashodhan in forum Symbian
    Replies: 0
    Last Post: 2003-03-10, 03:52

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •