Problem in contact listener please help it's urgent!!!

Login to reply to this topic.
Wed, 2008-06-04 18:41
Joined: 2007-07-05
Forum posts: 11

Hi

In this code appClosed comes when we add new contact in phone book, i don't now what is the problem. this exe wait in back ground and any event comes in phonebook, HandleDatabaseEventL function listen, but ptint_int(4) not show 4 but 3 shows when exe invoke. Please help me, my requirement is that if any contact add or change in phone book, i want it contact id.

CContactReader :: CContactReader()
{

}
CContactReader::~CContactReader()
{

}

//==============================================================//
// Create instance of the CContactReader
//==============================================================//
CContactReader* CContactReader::NewLC()
{
CContactReader* self = new (ELeave) CContactReader();
CleanupStack::PushL(self);
self->ConstructL();
return self;
}

void CContactReader:: ConstructL()
{
print_int(1);
CContactDatabase* ContactDatabase = CContactDatabase::OpenL();

// Here iContactDatabaseObserver is a CContactDatabaseObserver pointer //
print_int(2);
CContactChangeNotifier* DatabaseNotifier =
CContactChangeNotifier::NewL(*ContactDatabase , iContactDatabaseObserver);
print_int(3);
}

void CContactReader::HandleDatabaseEventL(TContactDbObserverEvent aEvent)
{
print_int(4);

switch(aEvent.iType)
{
case EContactDbObserverEventContactAdded:
{
print_int(5);
}break;
case EContactDbObserverEventContactDeleted:
{
print_int(6);
}break;
case EContactDbObserverEventContactChanged:
{
print_int(7);
}break;
default:
break;

}
// Do Something
}


Thu, 2008-06-05 05:15
Joined: 2008-01-16
Forum posts: 167
Re: Problem in contact listener please help it's urgent!!!

Hi kalpi21amit,

Go through below link:-
http://discussion.forum.nokia.com/forum/showthread.php?t=20171
&
http://wiki.forum.nokia.com/index.php/Getting_Contact_Database_Change_Event
Hopefully this will help you.


Thanks & Regards,
Md.Khalid Ahmad

Thu, 2008-06-05 11:23
Joined: 2007-07-05
Forum posts: 11
Re: Problem in contact listener please help it's urgent!!!

thanks khalid,

I am using like this, but App closed when any we do any changes in contacts, i do'nt know why, HandleDataBaseEventL is not calling. Please help me.

Thu, 2008-06-05 14:27
Forum Nokia Champion
Joined: 2006-10-12
Forum posts: 463
Re: Problem in contact listener please help it's urgent!!!

Knowing what error the app closes with might help understand better what might be happening. Debugging is also a great choice to see if the flow is as intended.

Thu, 2008-06-05 17:04
Joined: 2007-07-05
Forum posts: 11
Re: Problem in contact listener please help it's urgent!!!

Hi it is solved, thanks

Fri, 2008-06-06 19:23
Forum Nokia Champion
Joined: 2006-10-12
Forum posts: 463
Re: Problem in contact listener please help it's urgent!!!

Hi it is solved, thanks

And wouldnt you want to share your solution with others who might be looking out for same solution. I often tell developers to search as most of the issues are discussed earlier. If all the threads ended with a 'i solved it' and no indication of what solution solved it,....well imagine!!

Sat, 2008-06-07 08:09
Joined: 2007-07-05
Forum posts: 11
Re: Problem in contact listener please help it's urgent!!!

Thanks Neil,

Sorry for that.

problem is following code in bold part

CContactChangeNotifier* DatabaseNotifier =
CContactChangeNotifier::NewL(*ContactDatabase , iContactDatabaseObserver[b]);

Solution is there. just pass this instead of iContactDatabaseObserver.

CContactChangeNotifier* DatabaseNotifier =
CContactChangeNotifier::NewL(*ContactDatabase ,this);

  • Login to reply to this topic.