×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    17

    RunL is not called on device, but it works well in emulator!

    hi, experts
    a strange problem!
    I use Active object and scheduler mechnism to do some asychronous request. It works well in emulator, I mean, when the connection is done, the RunL is called, but when I porting the app to my device(E71), athough
    the connection is connected, the RunL is never called. why?
    here is code fragment:
    Code:
    //send request
    void CMailEngine::SetupConnectionL()
      {
    	if (iConnectionSetupDone)
    		{
    		// Connection setup is done
    		User::Leave(KErrAlreadyExists);
    		}
    	if (IsActive())
    		{
    		User::Leave(KErrInUse);
    		}
    	// Open HTTP Session
    	iSession.OpenL();
    
    	TCommDbConnPref prefs;
    	prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
    	prefs.SetDirection(ECommDbConnectionDirectionOutgoing);
    	TUint32 IAPID = GetCMWAPID(); //get IAPID
    	prefs.SetIapId(IAPID);
    	
    
    	User::LeaveIfError(iSocketServ.Connect());
    	User::LeaveIfError(iConnection.Open(iSocketServ));
    
    	//an asynchronous request, so we need use CActive framework
    	iState = EConnected;
    	
    	iLoger->OutPutlog(level0,"before iConnection.Start()");
    	
    	iConnection.Start(prefs, iStatus);
    	SetActive();
    	return;
    }
    Code:
    //RunL function:
    void CMailEngine::RunL()
    	{
    	CEikonEnv::Static()->InfoWinL(_L("haha:"), _L("RunL is called!"));
    	TInt statusCode = iStatus.Int();
    
    	if (!iConnectionSetupDone && statusCode == KErrNone)
    		{
    		// Connection done ok
    		iConnectionSetupDone = ETrue;
    		switch (iState)
    			{
    			case EConnected:
    				CEikonEnv::Static()->InfoWinL(_L("haha:"), _L("connection done, then get mail!"));
    				DoGetMailL();
    				break;
    			default:
    				break;
    			}
    		}
    	}
    thanks
    stone
    Last edited by ltomuta; 2010-01-17 at 10:39. Reason: Added [code] formatting

  2. #2
    Super Contributor
    Join Date
    Jan 2007
    Location
    Bhubaneswar, India
    Posts
    1,189

    Re: RunL is not called on device, but it works well in emulator!

    you can go for On Device debugging.
    -------------------------------------
    Thanks & Regards
    Ram
    Symbian OS 9.2/9.3,S60 3rd FP1/FP2,Carbide.c++v2.0

  3. #3
    Registered User
    Join Date
    Jul 2007
    Location
    Noida
    Posts
    1,503

    Re: RunL is not called on device, but it works well in emulator!

    Why are you calling return; after setActive()? Is there any specific reason. try to make log files for debugging.
    Regards,
    Amit


    ****"Putting a Smile on other's faces is the essence of true Happiness"****

  4. #4
    Registered User
    Join Date
    Jan 2010
    Posts
    17

    Re: RunL is not called on device, but it works well in emulator!

    thank you for your response!
    In fact, no specific reason to call "return", just to indicate the function ends here.
    And I debugged by TRK on the device(E71), Now the RunL() funcation can be called, but the "statusCode" is always -46(see code below), check the system error code, it seems that it is related to a security violation, the app is developer singed, Is it related to the singed?

    //code fragement:
    void CMailEngine::RunL()
    {
    CEikonEnv::Static()->InfoWinL(_L("haha:"), _L("RunL is called!"));
    // here "statusCode" is always -46,
    TInt statusCode = iStatus.Int();

    if (!iConnectionSetupDone && statusCode == KErrNone)
    {
    // Connection done ok
    iConnectionSetupDone = ETrue;
    switch (iState)
    {
    case EConnected:
    CEikonEnv::Static()->InfoWinL(_L("haha:"), _L("connection done, then get mail!"));
    DoGetMailL();
    break;
    default:
    break;
    }
    }
    }

    thanks
    stone

  5. #5
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: RunL is not called on device, but it works well in emulator!

    -46 simply means that you are missing a required capability, thus check the capabilities needed by functions you are using.

  6. #6
    Registered User
    Join Date
    Jan 2010
    Posts
    17

    Re: RunL is not called on device, but it works well in emulator!

    hi, all
    it works now. I am glad to share the solution.
    from "Project Explore", double-click the mmp file to open it, in the "Options" tab, there is a "Capabilities" item,
    we need choose the capabilities. for example, NetworkService.
    thank you all! This is a realy helpful community!



    thanks
    stone

Similar Threads

  1. FTP problem: works on emulator, but fails on device
    By jumartinelli in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2009-11-03, 22:15
  2. Replies: 106
    Last Post: 2009-05-11, 05:53
  3. ActiveObject RunL is called just once
    By lskmao in forum Symbian
    Replies: 3
    Last Post: 2007-01-18, 15:15
  4. Is there emulator or device that support JSR205 ?
    By seno_ap in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2005-02-18, 13:20
  5. Replies: 1
    Last Post: 2002-05-16, 19:08

Posting Permissions

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