|
|
User login
Feeds |
Incoming Message and Missed Call Notifications
|
|||||
| Mon, 2004-12-13 11:17 | |
|
I am observing the missed calls and Incoming messages. When there is a new message, my app gets notified of the same .But when i go to inbox and read the message , i dont get the notification . How can i get the notification for that also ?? Also i am unable to get the notification for a missed call using Log Engine ... this is what i am doing for missed calls notifications...... Code: CCallStatus::CCallStatus(MCallObserver* aOb):CActive(0), iCallObserver(aOb) { iState=EIdle; iLogClient=NULL; iRecentLogView=NULL; iFilter=NULL; CActiveScheduler::Add(this); } CCallStatus::~CCallStatus() { Cancel(); delete iRecentLogView; delete iFilter, delete iLogClient; delete iEvent; iFsSession.Close(); // delete iCallObserver; iCallObserver=NULL; } CCallStatus* CCallStatus::NewL(MCallObserver* aOb) { CCallStatus* self = new(ELeave) CCallStatus(aOb); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); return self; } void CCallStatus::ConstructL() { User::LeaveIfError(iFsSession.Connect()); iLogClient = CLogClient::NewL(iFsSession,CActive::EPriorityStandard); iEvent=CLogEvent::NewL(); iRecentLogView = CLogViewRecent::NewL(*iLogClient, CActive::EPriorityStandard); iFilter = CLogFilter::NewL(); iFilter->SetEventType(KLogCallEventTypeUid); // set the direction to incoming //iFilter->SetDirection(_L("Missed call")); } void CCallStatus::GetCallStatus() { Start(); } void CCallStatus::Start() { if(!IsActive()) { SetState(EWaitingEvent); iStatus = KRequestPending; iLogClient->NotifyChange(0,iStatus); SetActive(); } } void CCallStatus::RunL() { if(iStatus!=KErrNone) {//success //================================================================== switch(iState) { case EWaitingEvent: { // iLogger.Log(KWaitingEvent); if(!UpdateRecentView()) Start(); } break; case EGettingRecent: { // iLogger.Log(KGettingRecent); if(!IsViewEmpty(*iRecentLogView)) { //Failure break; } else { //Success const CLogEvent& event = iRecentLogView->Event(); if (event.Description() == _L("Missed call")) { iCallObserver->OnCallMissed(1); } } Start(); } break; case ENextRecent: { // Start(); } break; case EIdle: default: { SetState(EIdle); User::Leave(KErrNotSupported); } } //================================================================== } else {//error //LogEngineError(iStatus.Int()); User::Leave(iStatus.Int()); } } void CCallStatus::DoCancel() { switch(iState) { case EIdle: /* nothing to do*/ break; case EWaitingEvent: { iLogClient->NotifyChangeCancel(); break; } case EGettingRecent: case ENextRecent: { iRecentLogView->Cancel(); break; } default: break; } SetState(EIdle); } TInt CCallStatus::RunError( TInt aError ) { return KErrNone; } TBool CCallStatus::IsIdle() { return (iState==EIdle); } TBool CCallStatus::UpdateRecentView() { TBool result = EFalse; iStatus = KRequestPending; TRAPD(error, result = iRecentLogView->SetRecentListL(KLogNullRecentList, *iFilter, iStatus)); result = result && (error==KErrNone); if(result) { SetState(EGettingRecent); SetActive(); // iLogger.Log(_L("[+] Updating recent view")); } // else // iLogger.Log(_L("[-] No recent events to view")); return result; } TBool CCallStatus::IsViewEmpty(CLogView &aView) { TBool result = EFalse; TInt count = 0; TRAPD(error, count = aView.CountL()); result = (error != KErrNone) || (count<=0); return result; } void CCallStatus::SetState(TLogEngineState aState) { iState = aState; } Thanks |
|
But here is the example for catch incoming sms:
void CSmsReceiveHandler::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* /*aArg3*/)
{
switch (aEvent)
{
case EMsvEntriesChanged: // A new entry has been created in the message server
{
// We are interested in messages that are created in Inbox
TMsvId* entryId = static_cast<TMsvId*>(aArg2); // entry id from the session event
if (*entryId == KMsvGlobalInBoxIndexEntryId) // new entry has been created in Inbox folder
{
// We take the created entries into a selection
CMsvEntrySelection* entries = static_cast<CMsvEntrySelection*>(aArg1);
//Process each created entry, one at a time.
for(TInt i = 0; i < entries->Count(); i++)
{
MessageReceivedL(entries->At(i)); // this checks the entry and handles it if it is targeted to SMS app
}
}
}
break;
// This event tells us that the session has been opened
case EMsvServerReady:
CompleteConstructL(); // Construct the mtm registry
break;
case EMsvCloseSession:
// Handle close session
iSession->CloseMessageServer();
break;
case EMsvServerTerminated:
// Handle server terminated
iSession->CloseMessageServer();
break;
case EMsvGeneralError:
case EMsvServerFailedToStart:
// A major problem has occurred
iObserver.HandleError(MMsvObserver::EFatalServerError);
break;
default:
// All other events are ignored
break;
}
}
Forum posts: 308
When a new SMS comes , i get a Small envolope on top right of the phone.
When the sms is read , the envolope goes.I.e
what i want .when the sms is read ???Basically i also want to take off that envolope when the sms is read byt thru my application .
Thanks
Amit
Forum posts: 34
Are you sure that your code for missed calls catching works ?
I try to use it but I can't get recent event from log
Regards Dilian
Forum posts: 276
I think it can be done by the following piece of code.... Just try it.... I hope you are getting the msvEntry and SMS mtm instance.....
iSmsMtm->Entry().ChangeL(msvEntry);
Dennis
Today is a gift by GOD, that's why it is called the present.
Forum posts: 34
I need from help! When I make TBool CCallStatus::UpdateRecentView() from amit's example iStatus is 0 and I can't get events from recentLog