×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Regular Contributor
    Join Date
    May 2008
    Posts
    120

    Unhappy Issue with Foreground and Background tasks

    Hello all ,

    I have an issue which drives me nuts :
    In my AppUI file i have the followin code which suppose to send my App to background and after X seconds bring it back .
    In emulator = Working
    In N95 = Not Working
    All i know is that after i press the Back button (my right soft key) the App goes to background and the Applications menu of the Nokia is shown , and nothing happens .

    Code:
    void CBoomeringAppUi::HandleCommandL( TInt aCommand )
    {
     TBool commandHandled = EFalse;
     switch ( aCommand )
    	{ default:
              break;
    	}
    	
    		
     if ( !commandHandled ) 
       {
       if ( aCommand == EAknSoftkeyExit || aCommand == EEikCmdExit )
    	{
    	RWsSession iWsSession;
    	User::LeaveIfError(iWsSession.Connect());
    	TApaTaskList taskList(iWsSession); 			
            TApaTask task1 = taskList.FindApp (KUidMine );
    	TApaTask task = taskList.FindApp (KUidStandby );
    	 
    	if (task1.Exists ( ) ) 
    		{
    		User::After(10000);
    		task1.SendToBackground();
    		/User::After(90000);
    		task1.BringToForeground();
    		}
    	}
        }
    	
    }
    Please advice
    One small step for me , one giant leap for mankind :)

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Issue with Foreground and Background tasks

    Do you have SwEvent capability for your application.

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Issue with Foreground and Background tasks

    Skumar is most likely right. However note that if a code works in the emulator, it is possible to search for possibly missing capabilities in the logfile of the emulator: http://wiki.forum.nokia.com/index.php/Epocwind.out

  4. #4
    Regular Contributor
    Join Date
    May 2008
    Posts
    120

    Re: Issue with Foreground and Background tasks

    Quote Originally Posted by skumar_rao View Post
    Do you have SwEvent capability for your application.
    Yes , i have all neccesary capabilities.
    I use Carbide.C++ 1.3 , S60 3rd FP1 , Device = N95.
    Note that my code is in my AppUi file .
    Is that the right location? should i move the code to the ItemListView file ?

    the final goal :
    listen in background to outgoing call and end it .
    should i listen to green button (couldnt find in forum what ENUm value it has) or to Network Status?
    One small step for me , one giant leap for mankind :)

  5. #5
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Issue with Foreground and Background tasks

    it does not matter where you want to call task1.SendToBackground();
    you should listen to Network Status.

    note: task1.SendToBackground(); and task1.BringToForeground();

  6. #6
    Regular Contributor
    Join Date
    May 2008
    Posts
    120

    Re: Issue with Foreground and Background tasks

    Quote Originally Posted by skumar_rao View Post
    it does not matter where you want to call task1.SendToBackground();
    you should listen to Network Status.

    note: task1.SendToBackground(); and task1.BringToForeground();
    on the same subject :
    if i send my app to background using the task capabilities , can i listen to Network Status ? Should i create an AO for listening?

    i read that the Phone App has highest priority and that if i dont own a voice call , i cant do anything .
    One small step for me , one giant leap for mankind :)

  7. #7
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Issue with Foreground and Background tasks

    yes you can listen to Network Status, using CTelephony class refer to wiki CTelephony examples.
    yes you hard it right and there are workarounds too. refer to wiki

  8. #8
    Regular Contributor
    Join Date
    May 2008
    Posts
    120

    Re: Issue with Foreground and Background tasks

    Quote Originally Posted by skumar_rao View Post
    yes you can listen to Network Status, using CTelephony class refer to wiki CTelephony examples.
    yes you hard it right and there are workarounds too. refer to wiki
    i have all of wiki examples on CTelephony .
    I havent found a workaround that priority issue between my app and the phone app .
    should i set my application priority to a different level ?
    One small step for me , one giant leap for mankind :)

  9. #9
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Issue with Foreground and Background tasks

    you can't put your application a different priority. (at least i donot know how to do it.) you can only change priorities of a active object not total application.

    have to tried getting what ever info from dialed call and hanging it ?

  10. #10
    Regular Contributor
    Join Date
    May 2008
    Posts
    120

    Re: Issue with Foreground and Background tasks

    Quote Originally Posted by skumar_rao View Post
    you can't put your application a different priority. (at least i donot know how to do it.) you can only change priorities of a active object not total application.

    have to tried getting what ever info from dialed call and hanging it ?
    I tried to simulate END-Key Press in a method which is a part of an AO , as follows :

    Code:
    void CNotifyEngine::RequestNotification()
    {
    
    _LIT( KNotifyExamplePanic, "CNotifyEngine" );
    __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyExamplePanic, 1 ));
    Cancel();
    iTelephony->NotifyChange(iStatus,CTelephony::EVoiceLineStatusChange,iLineStatusPckg );
    SetActive();
    }
    
    
    void CNotifyEngine::RunL()
        {
        if( iStatus==KErrNone )
           {
            if ( iLineStatus.iStatus == CTelephony::EStatusDialling) )
          {
          User::After(1000);   	   
          CTelephony::TCallInfoV1 callInfoV1;
          CTelephony::TCallInfoV1Pckg callInfoV1Pckg( callInfoV1 );
          CTelephony::TCallSelectionV1 callSelectionV1;
          CTelephony::TCallSelectionV1Pckg callSelectionV1Pckg( callSelectionV1 );
          CTelephony::TRemotePartyInfoV1 remotePartyInfoV1;
          CTelephony::TRemotePartyInfoV1Pckg remotePartyInfoV1Pckg( remotePartyInfoV1 );
     
          callSelectionV1.iLine = CTelephony::EVoiceLine;
          callSelectionV1.iSelect = CTelephony::EInProgressCall;
        	   
          iTelephony->GetCallInfo( callSelectionV1Pckg, callInfoV1Pckg, remotePartyInfoV1Pckg );
           //FETCH NUMBER FROM NETWORK - MISSING
        	 User::After(10000);
        	  HangUpOnGoingCall(); 
           
       }
          
    
          
           iTelephony->NotifyChange( iStatus,
                                  CTelephony::EVoiceLineStatusChange,
                                  iLineStatusPckg );
           SetActive();
           }
        }
    
    
    void CNotifyEngine::DoCancel()
    {
          iTelephony->CancelAsync( CTelephony::EVoiceLineStatusChangeCancel );
    }
    
    void CNotifyEngine::HangUpOnGoingCall()
    {
    	RWsSession ws; 
    	ws.Connect(); 
    	TRawEvent ev1;  
    	ev1.Set(TRawEvent::EKeyDown, EStdKeyNo); 
    	ws.SimulateRawEvent(ev1); // CAPABILITY Req. SwEvent
    	User::After(1000000); 
    	TRawEvent ev2;  
    	ev2.Set(TRawEvent::EKeyUp, EStdKeyNo); 
    	ws.SimulateRawEvent(ev2); // CAPABILITY Req. SwEvent
    	ws.Close();
    }
    One small step for me , one giant leap for mankind :)

  11. #11
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Issue with Foreground and Background tasks

    what is the error you are getting ?

  12. #12
    Regular Contributor
    Join Date
    May 2008
    Posts
    120

    Re: Issue with Foreground and Background tasks

    Quote Originally Posted by skumar_rao View Post
    what is the error you are getting ?
    Well , there is no error .
    As i said at the beginning , i cant make the task switching in the device. in the emulator the task switching works like a charm (i know the emulator has no phone app so i didnt put in the code of the network status listener to work) .
    on the device (N95) the switch isnt working . my App goes to background and doesnt come back after X seconds which i set for it , using the User::After(X) command .

    moreover , i have tried for more than 2 weeks to figure out how to catch outgoing call , reading the examples and the wiki here , with no success. i understand i need to create an AO who will listen to the Network and notify for a cahnge. if EDiallingStatus (inside RunL() ) than get the info and hangup. all well in theory , couldnt get it to work

    suppose i adopt the NotifyExample as mentioned here :
    http://www.symbian.com/developer/tec...phony%2enotify

    1. I assume that CActiveSchuder::Add(this) is missing in constructor - or am i missing info in head?
    2. I changed the type of notification to EStatusDialling - is it right to do so? after all , the assumption is that i don't own the initial call (from the phone app)
    3. I have put the HangUp Simulation you wrote before as an action to perfrom if someone is trying to make outgoing call - will it hang it up?
    Last edited by aavi; 2008-06-30 at 12:29. Reason: Explainig my problem better
    One small step for me , one giant leap for mankind :)

  13. #13
    Regular Contributor
    Join Date
    Jun 2007
    Location
    INDIA
    Posts
    73

    Re: Issue with Foreground and Background tasks

    First Issue:
    Is this behaviour happens when you are using phone application or even when no application is running also.

    Second Issue:
    As per my knowledge,

    We can't terminate a call, which we don't OWN.

    The work around I knew is 'SIMULATION OF RED KEY'.



    Quote Originally Posted by aavi View Post
    Well , there is no error .
    As i said at the beginning , i cant make the task switching in the device. in the emulator the task switching works like a charm (i know the emulator has no phone app so i didnt put in the code of the network status listener to work) .
    on the device (N95) the switch isnt working . my App goes to background and doesnt come back after X seconds which i set for it , using the User::After(X) command .

    moreover , i have tried for more than 2 weeks to figure out how to catch outgoing call , reading the examples and the wiki here , with no success. i understand i need to create an AO who will listen to the Network and notify for a cahnge. if EDiallingStatus (inside RunL() ) than get the info and hangup. all well in theory , couldnt get it to work

  14. #14
    Regular Contributor
    Join Date
    May 2008
    Posts
    120

    Re: Issue with Foreground and Background tasks

    Quote Originally Posted by bytes View Post
    First Issue:
    Is this behaviour happens when you are using phone application or even when no application is running also.

    Second Issue:
    As per my knowledge,

    We can't terminate a call, which we don't OWN.

    The work around I knew is 'SIMULATION OF RED KEY'.
    Hello bytes , thanx for your reply .
    i did simulate the red key :-)
    still i cant get it to work if i send my app to background. since emulator has no phone app , i cant test it on the emulator.
    also - the basic problem of switching between my app the the standby screen still stands :
    On Emulator is switched after X seconds (i wrote it like that) and on the phone it doesnt work
    One small step for me , one giant leap for mankind :)

  15. #15
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Issue with Foreground and Background tasks

    Which capability you have ?

Similar Threads

  1. Replies: 0
    Last Post: 2008-04-24, 12:33
  2. texteditor, background, foreground
    By noman_csedu in forum Symbian
    Replies: 4
    Last Post: 2007-08-22, 08:11
  3. texteditor, background, foreground
    By noman_csedu in forum Symbian
    Replies: 3
    Last Post: 2007-08-22, 07:38
  4. Replies: 2
    Last Post: 2007-06-04, 06:01
  5. Program background / foreground
    By jackxie in forum Mobile Java General
    Replies: 1
    Last Post: 2006-07-13, 18:36

Posting Permissions

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