×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,349

    console app doesn't start at auto start

    Hi,
    I am create a console app that should automatically run after I install it, but its not running, I have check in the process list using the Y-Task, its not there, but the other running apps are there in the process list.
    here is the code
    E20841DA.rss where E20841DA is the UID of the application (Not Protected) i am using developer sertificate.
    Code:
    #include <startupitem.rh>
     
    RESOURCE STARTUP_ITEM_INFO devinfo
        {
        executable_name = "!:\\sys\\bin\\Timer.exe";
        recovery = EStartupItemExPolicyNone;
        }
    .mmp file
    Code:
    SOURCEPATH 			..\data
    START RESOURCE 		E20841DA.rss
    	TARGET 			E20841DA.rsc
    	TARGETPATH 		\resource
    END
    .pkg file
    Code:
    "$(EPOCROOT)epoc32\data\z\resource\Startup.rsc"		  -"c:\private\101f875a\import\[E20841DA].rsc"
    "$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\Timer.exe"		  -"!:\sys\bin\Timer.exe",FR,RI
    .cpp file
    Code:
    LOCAL_D CConsoleBase* console; // write all messages to this
    
    
    //  Local Functions
    
    LOCAL_C void MainL()
    	{
    	//
    	// add your program code here, example code below
    	//
    	console->Write(_L("Hello, world!\n"));
    	}
    
    LOCAL_C void DoStartL()
    	{
    	// Create active scheduler (to run active objects)
    	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    	CleanupStack::PushL(scheduler);
    	CActiveScheduler::Install(scheduler);
    	CActiveObject  *iActiveObj = CActiveObject::NewL();
    	CleanupStack::PushL(iActiveObj);
    	scheduler->Start();
    	// Delete active scheduler
    			CleanupStack::PopAndDestroy(iActiveObj);
    			CleanupStack::PopAndDestroy(scheduler);
    	
    	}
    
    //  Global Functions
    
    GLDEF_C TInt E32Main()
    	{
    	// Create cleanup stack
    		__UHEAP_MARK;
    		CTrapCleanup* cleanup = CTrapCleanup::New();
    
    		// Run application code inside TRAP harness, wait keypress when terminated
    		TRAPD(mainError, DoStartL());
    		
    		delete cleanup;
    		__UHEAP_MARKEND;
    		return KErrNone;
    	}

    Please let me know where I am making mistake

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

    Re: console app doesn't start at auto start

    You may be installing something else than your file
    Quote Originally Posted by somnathbanik View Post
    E20841DA.rss where E20841DA is the UID of the application (Not Protected) i am using developer sertificate.

    .mmp file
    Code:
    SOURCEPATH 			..\data
    START RESOURCE 		E20841DA.rss
    	TARGET 			E20841DA.rsc
    	TARGETPATH 		\resource
    END
    .pkg file
    Code:
    "$(EPOCROOT)epoc32\data\z\resource\Startup.rsc"		  -"c:\private\101f875a\import\[E20841DA].rsc"

  3. #3
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,958

    Re: console app doesn't start at auto start

    Also according to your post, i think your requirement is to start the application as soon as it is installed in the device, but the code you have putted here is for the issue of auto starting it as soon as the device is restarted, which are two separate things.

    Also note that neither giving FR,RI in pkg file, nor Autostart feature works for self signed sis files.You need to opt for Open signed Online signing or signing from developer certificate to run the sis file.

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

    Re: console app doesn't start at auto start

    He says he is using a devcert. And you are certainly familiar with his use-case from the other threads, so it is easy to find out that he probably needs both start on install and start on boot.

  5. #5
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,349

    Re: console app doesn't start at auto start

    Quote Originally Posted by wizard_hu_ View Post
    You may be installing something else than your file
    Yes Wizard_hu_ you are right. I am installing a different file. so I changed the pkg file code
    Code:
    "$(EPOCROOT)epoc32\data\z\resource\E20841DA.rsc"		  -"c:\private\101f875a\import\[E20841DA].rsc"
    "$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\Timer.exe"		  -"!:\sys\bin\Timer.exe",FR,RI
    But still is not starting after installing not even after restart. Is there anything else I need to check.
    .mmp
    Code:
    SOURCEPATH 			..\data
    START RESOURCE 		E20841DA.rss
    	TARGET 			E20841DA.rsc
    	TARGETPATH 		\resource
    END
    E20841DA.rss
    Code:
    #include <startupitem.rh>
     
    RESOURCE STARTUP_ITEM_INFO devinfo
        {
        executable_name = "!:\\sys\\bin\\Timer.exe";
        recovery = EStartupItemExPolicyNone;
        }

  6. #6
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,958

    Re: console app doesn't start at auto start

    can you show the full content of pkg, mmp file. Also did you made any logs in timer .exe to check if the exe is launched on startup or not?

  7. #7
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,349

    Re: console app doesn't start at auto start

    Quote Originally Posted by vineet.jain View Post
    can you show the full content of pkg, mmp file. Also did you made any logs in timer .exe to check if the exe is launched on startup or not?
    .pkg
    Code:
    ; Installation file for Symbian OS 9.x for generic console application
    ; Installation file for Timer EXE
    ;
    ; This is an auto-generated PKG file by Carbide.
    ; This file uses variables specific to Carbide builds that will not work
    ; on command-line builds. If you want to use this generated PKG file from the
    ; command-line tools you will need to modify the variables with the appropriate
    ; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
    ;
    
    ;
    ; UID is the exe's UID
    ;
    #{"Timer EXE"},(0xE20841DA),1,0,0
    
    
    ;Localised Vendor name
    %{"Vendor-EN"}
    
    ;Unique Vendor name
    :"Vendor"
    
    "$(EPOCROOT)epoc32\data\z\resource\E20841DA.rsc"		  -"c:\private\101f875a\import\[E20841DA].rsc"
    "$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\Timer.exe"		  -"!:\sys\bin\Timer.exe",FR,RI
    .mmp
    Code:
    /*
    ============================================================================
     Name		: Timer.mmp
     Author	  : 
     Copyright   : Your copyright notice
     Description : This is the project specification file for Timer.
    ============================================================================
    */
    
    TARGET		  Timer.exe
    TARGETTYPE	  exe
    UID			 0 0xE20841DA
    
    USERINCLUDE	 ..\inc
    SYSTEMINCLUDE   \epoc32\include
    
    SOURCEPATH	  ..\src
    SOURCE		  Timer.cpp ActiveObject.cpp
    
    
    
    
    LIBRARY		 euser.lib
    
    LIBRARY		   apparc.lib
    LIBRARY		   cone.lib
    LIBRARY		   eikcore.lib
    LIBRARY		   avkon.lib
    LIBRARY		   commonengine.lib
    LIBRARY		   efsrv.lib 
    LIBRARY		   estor.lib
    LIBRARY        aknnotify.lib
    LIBRARY        hlplch.lib
    LIBRARY        bafl.lib 
    LIBRARY        esock.lib http.lib ecom.lib inetprotutil.lib
    LIBRARY		   msgs.lib  gsmu.lib mtur.lib 
    LIBRARY        apengine.lib etel3rdparty.lib
    LIBRARY        centralrepository.lib cntmodel.lib edbms.lib
    
    LIBRARY        commdb.lib connmon.lib // gprs connection
    
    //START RESOURCE			 E20841DA.rss
    //TARGETPATH 	      \private\101f875a\import
    //END
    
    SOURCEPATH 			..\data
    START RESOURCE 		E20841DA.rss
    	TARGET 			E20841DA.rsc
    	TARGETPATH 		\resource
    END
    
    
    
    
    #ifdef ENABLE_ABIV2_MODE
    DEBUGGABLE_UDEBONLY
    #endif
    
    SECUREID 0xE20841DA
    VENDORID 0
    
    CAPABILITY LocalServices Location NetworkControl NetworkServices ReadDeviceData ReadUserData UserEnvironment WriteDeviceData WriteUserData

    I have not added any log to check , but I am checking using Y-Task. I did the same for a GUI application and the app starts after installing and also in device restart. But the same code is not working for Console.

  8. #8
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,958

    Re: console app doesn't start at auto start

    In the DoStartL() function :


    CActiveObject *iActiveObj = CActiveObject::NewL();
    CleanupStack::PushL(iActiveObj);
    scheduler->Start();

    before calling the CActiveSheduler::Start(), did you placed any async request? i mean does the statement:

    CActiveObject *iActiveObj = CActiveObject::NewL();
    only creates an object of a class named CActiveObject or does it also include the placing of any async request also? , as that is a necessary condition before calling the start() of CActiveSheduler().

    So it may be a case that exe is launching but its crashing as soon as it is launched.

  9. #9
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,349

    Re: console app doesn't start at auto start

    Quote Originally Posted by vineet.jain View Post
    In the DoStartL() function :


    CActiveObject *iActiveObj = CActiveObject::NewL();
    CleanupStack::PushL(iActiveObj);
    scheduler->Start();

    before calling the CActiveSheduler::Start(), did you placed any async request? i mean does the statement:

    CActiveObject *iActiveObj = CActiveObject::NewL();
    only creates an object of a class named CActiveObject or does it also include the placing of any async request also? , as that is a necessary condition before calling the start() of CActiveSheduler().

    So it may be a case that exe is launching but its crashing as soon as it is launched.
    Here is the code
    Code:
    LOCAL_C void DoStartL()
    	{
    	// Create active scheduler (to run active objects)
    	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    	CleanupStack::PushL(scheduler);
    	CActiveScheduler::Install(scheduler);
    	CActiveObject  *iActiveObj = CActiveObject::NewL();
    	CleanupStack::PushL(iActiveObj);
    	scheduler->Start();
    	//MainL();
    
    	// Delete active scheduler
    	// Delete active scheduler
    			CleanupStack::PopAndDestroy(iActiveObj);
    			CleanupStack::PopAndDestroy(scheduler);
    	
    	}
    activeobject.cpp
    Code:
    /*
     ============================================================================
     Name		: ActiveObject.cpp
     Author	  : 
     Version	 : 1.0
     Copyright   : Your copyright notice
     Description : CActiveObject implementation
     ============================================================================
     */
    
    #include "ActiveObject.h"
    #include <e32base.h>
    #include <e32std.h>
    #include <e32cons.h>
    LOCAL_D CConsoleBase* console; // write all messages to this
    
    CActiveObject::CActiveObject() :
    	CActive(EPriorityStandard) // Standard priority
    	{
    	}
    
    CActiveObject* CActiveObject::NewLC()
    	{
    	CActiveObject* self = new (ELeave) CActiveObject();
    	CleanupStack::PushL(self);
    	self->ConstructL();
    	return self;
    	}
    
    CActiveObject* CActiveObject::NewL()
    	{
    	CActiveObject* self = CActiveObject::NewLC();
    	CleanupStack::Pop(); // self;
    	return self;
    	}
    
    void CActiveObject::ConstructL()
    	{
    	User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer
    	CActiveScheduler::Add(this); // Add to scheduler
    	StartL(1000000);   // at time
    	}
    
    CActiveObject::~CActiveObject()
    	{
    	Cancel(); // Cancel any request, if outstanding
    	iTimer.Close(); // Destroy the RTimer object
    	// Delete instance variables if any
    	}
    
    void CActiveObject::DoCancel()
    	{
    	iTimer.Cancel();
    	}
    
    void CActiveObject::StartL(TTimeIntervalMicroSeconds32 aDelay)
    	{
    	Cancel(); // Cancel any request, just to be sure
    	iState = EUninitialized;
    	iTimer.After(iStatus, aDelay); // Set for later
    	SetActive(); // Tell scheduler a request is active
    	}
    
    void CActiveObject::RunL()
    	{
    	if (iState == EUninitialized)
    		{
    		// Do something the first time RunL() is called
    		iState = EInitialized;
    		}
    	else if (iState != EError)
    		{
    		// Do something
    		}
    	switch (iStatus.Int())
    			{
    			case KErrNone:
    				{
    				
    				console->Write(_L("Hello, world!\n"));
    				// do something
    				
    				StartL(1000000);
    					break;
    				}
    				
    			
    					
    				default:
    					break;
    			}
    	
    	//iTimer.After(iStatus, 1000000); // Set for 1 sec later
    	//SetActive(); // Tell scheduler a request is active
    	}
    
    TInt CActiveObject::RunError(TInt aError)
    	{
    	return aError;
    	}
    Last edited by somnathbanik; 2010-12-06 at 07:41. Reason: added

  10. #10
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,349

    Re: console app doesn't start at auto start

    Quote Originally Posted by vineet.jain View Post
    In the DoStartL() function :


    CActiveObject *iActiveObj = CActiveObject::NewL();
    CleanupStack::PushL(iActiveObj);
    scheduler->Start();

    before calling the CActiveSheduler::Start(), did you placed any async request? i mean does the statement:

    CActiveObject *iActiveObj = CActiveObject::NewL();
    only creates an object of a class named CActiveObject or does it also include the placing of any async request also? , as that is a necessary condition before calling the start() of CActiveSheduler().

    So it may be a case that exe is launching but its crashing as soon as it is launched.
    I got an example that starts automatically after installation. For the time being I am using that, and now I am able to launch my GUI app from the console app automatically.
    Here is the code to launch GUI app from console app
    Code:
    //launch app after 1 min
    		const TUid KAppUid={0xE89D8174};
    		_LIT(KDocName,"C:\\Data\\document.txt");
    		TThreadId app_threadid;
    		RApaLsSession ls;
    		User::LeaveIfError(ls.Connect());
    		TInt err=ls.StartDocument(KDocName, KAppUid, app_threadid);
    		ls.Close();
    Now could you please tell me how do i kill the console process from my GUI app.
    I used the code below but its not working
    Code:
    						
    			TFindProcess processFinder(_L("*[E4DAC78A]*")); // by UID3
    			TFullName result;
    			RProcess processHandle;
    			while (processFinder.Next(result) == KErrNone)
    				{
    				User::LeaveIfError(processHandle.Open(processFinder,
    						EOwnerThread));
    				processHandle.Kill(KErrNone);
    				processHandle.Close();
    				}
    Getting an error KERN-EXEX 46, i also went through the SDK doc but could not solve it
    followed this link http://wiki.forum.nokia.com/index.ph...t_and_stop_exe
    Last edited by somnathbanik; 2010-12-06 at 10:28. Reason: added

  11. #11
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,349

    Re: console app doesn't start at auto start

    I added the PowerMgmt Capability and now there is no error, but when I KILL the console application from my GUI application then the system reboot, and I belive it is not a good practive. Can we make a communication that the console application release the GUI app? Or can we suspand the console application?

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

    Re: console app doesn't start at auto start

    The TFindProcess code seems OK, however if it results in a reboot, perhaps it is worth the effort logging exactly what process(es?) you are killing.

    There is an other thing which may apply: the OS treats as some kind of a failure when auto-started code exits too soon (less than 10 seconds perhaps?). This is when the 'recovery' field can specify the necessary step. However EStartupItemExPolicyNone is definitely not expected to reboot the device. You can still try delaying the kill attempt.

    By the way, why does not your starter code simply exit after launching the GUI one? That would be slightly simpler - and the code could simply User::After(10000000) prior to exit.

  13. #13
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,349

    Re: console app doesn't start at auto start

    Quote Originally Posted by wizard_hu_ View Post
    The TFindProcess code seems OK, however if it results in a reboot, perhaps it is worth the effort logging exactly what process(es?) you are killing.

    There is an other thing which may apply: the OS treats as some kind of a failure when auto-started code exits too soon (less than 10 seconds perhaps?). This is when the 'recovery' field can specify the necessary step. However EStartupItemExPolicyNone is definitely not expected to reboot the device. You can still try delaying the kill attempt.

    By the way, why does not your starter code simply exit after launching the GUI one? That would be slightly simpler - and the code could simply User::After(10000000) prior to exit.
    Yes you are right, but what I am trying is ..
    I am trying to make one console app that will keep on running all the time and at a particular time it will launch my GUI app, which is wokring prefect. Now if I want to launch my GUI app at some other time then I need to change iTimer.At(iStatus, lTime); ITimer of my consol app from my GUI app, how do I do that, I mean do I need IPC for that?
    Last edited by somnathbanik; 2010-12-06 at 13:22. Reason: added

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

    Re: console app doesn't start at auto start

    Yes, you certainly have to either notify the starter app about the change, or shut it down and re-start with new settings.
    The first approach requires IPC, the second one requires fixing the reboot issue.

  15. #15
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,349

    Re: console app doesn't start at auto start

    Quote Originally Posted by wizard_hu_ View Post
    Yes, you certainly have to either notify the starter app about the change, or shut it down and re-start with new settings.
    The first approach requires IPC, the second one requires fixing the reboot issue.
    Could you please help me how can I make a IPC with my consol and the GUI app. I want to change the time of the console app from my GUI app.
    Here is the code of my consle app
    Code:
    void CController::Start()
    {
    	Cancel();
     if(!IsActive())
    	 {
    	
     TTime lTime;
     lTime.HomeTime();
     lTime += TTimeIntervalMinutes(1);//Seconds(60);
     	iTimer.At(iStatus, lTime);
    	SetActive();
    	 }
    }
    I want to chagne the parameter of TTimeIntervalMinutes of consolse app from my GUI app.

Similar Threads

  1. [moved] Auto App Start.
    By srivatsan.d in forum Symbian
    Replies: 30
    Last Post: 2010-05-28, 15:10
  2. Please help with auto start of my app
    By Boris S. in forum General Development Questions
    Replies: 5
    Last Post: 2009-05-12, 09:11
  3. Cannot auto start multilingual app during install
    By rdsantos in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2008-10-28, 06:04
  4. Auto Start app at device boot Up
    By Tasneem Rangwala in forum Symbian
    Replies: 9
    Last Post: 2007-10-12, 16:09
  5. Auto Start app at device boot Up
    By Tasneem Rangwala in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 0
    Last Post: 2007-05-25, 11:48

Posting Permissions

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