×

Discussion Board

Page 1 of 3 123 LastLast
Results 1 to 15 of 45
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    11

    autostart an application

    Dear Nokia!
    Is there a way to automatically start a background application when nokia 7650 is turned on?

    Peter

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    17

    RE: autostart an application

    hi,
    i also try desperately to find it out.... :-(
    has anybody made a working "auto start application"?

    thank you for the help.

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    60

    RE: autostart an application

    goto Nokia Knowledge base & search on Auto Start

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    28

    RE: autostart an application

    Hi,
    It seems that I have a working MDL to autostart my application on the emulator. I am hesitant to install it on the real device because of the problems I have read that people had with recognizers. Does anyone have any comments about this issue? If there is a problem, is there an easy way to reflash the phone or bypass the recognizer?

    Also, one more thing I would like to implement....I'd like to let the user determine whether the autostart functionality should be used or not. I am not sure where to even begin with this problem. Any ideas to get me started?

    Thanks!

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    17

    RE: autostart an application

    ok, guys
    this recognizer works great on my 7650.
    i use him as an autostart-function for my apps.
    here is my code:

    **********************************************
    CMyRecognizer::CMyRecognizer()
    :CApaDataRecognizerType(KUidemAMRec, CApaDataRecognizerType::ENormal)
    {
    iCountDataTypes = 1;
    }

    TUint CMyRecognizer::PreferredBufSize()
    {
    // no buffer recognition yet
    return 0;
    }


    TDataType CMyRecognizer::SupportedDataTypeL(TInt /*aIndex*/) const
    {
    return TDataType();
    }


    void CMyRecognizer:oRecognizeL(const TDesC& /*aName*/, const TDesC8&
    /*aBuffer*/)
    {
    // this function is never called
    }



    void CMyRecognizer::StartThread()
    {
    TInt res = KErrNone;

    //create a new thread for starting our application
    RThread * startAppThread;
    startAppThread = new RThread();

    User::LeaveIfError( res = startAppThread->Create(
    _L("MyThreadName&quot,
    CMyRecognizer::StartAppThreadFunction,
    KDefaultStackSize,
    KMinHeapSize,
    KMinHeapSize,
    NULL,
    EOwnerThread) );

    startAppThread->SetPriority(EPriorityNormal/*EPriorityLess*/);

    startAppThread->Resume();

    startAppThread->Close();
    }


    TInt CMyRecognizer::StartAppThreadFunction(TAny* /*aParam*/)
    {
    /*
    //wait 5 seconds...
    RTimer timer; // The asynchronous timer and ...
    TRequestStatus timerStatus; // ... its associated request status
    timer.CreateLocal(); // Always created for this thread.
    // get current time (microseconds since 0AD nominal Gregorian)
    TTime time;
    time.HomeTime();
    // add ten seconds to the time
    TTimeIntervalSeconds timeIntervalSeconds(5);
    time += timeIntervalSeconds;
    // issue and wait
    timer.At(timerStatus,time);
    User::WaitForRequest(timerStatus);
    */


    // create an active scheduler
    CActiveScheduler * scheduler = new CActiveScheduler();
    if( scheduler == NULL )
    return KErrNoMemory;

    CActiveScheduler::Install(scheduler);
    // create a TRAP cleanup
    CTrapCleanup * cleanup = CTrapCleanup::New();
    TInt err;
    if( cleanup == NULL )
    {
    err = KErrNoMemory;
    }
    else
    {
    TRAP( err, StartAppThreadFunctionL() );
    }
    delete cleanup;
    delete CActiveScheduler::Current();

    return err;
    }


    // thread function to start our application
    void CMyRecognizer::StartAppThreadFunctionL()
    {
    // absolute file path to our application
    TFileName fnAppPath = _L("\\system\\apps\\someapp\\somefile.app"

    RFs fsSession; //file server session
    User::LeaveIfError(fsSession.Connect());
    CleanupClosePushL(fsSession);
    TFindFile findFile( fsSession );

    User::LeaveIfError( findFile.FindByDir(fnAppPath, KNullDesC) );

    CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
    cmdLine->SetLibraryNameL( findFile.File() );
    cmdLine->SetCommandL( EApaCommandOpen );

    RApaLsSession ls;
    User::LeaveIfError(ls.Connect());
    CleanupClosePushL(ls);

    User::LeaveIfError( ls.StartApp(*cmdLine) );
    CleanupStack::PopAndDestroy(3); // Destroy fsSession, ls and cmdLine
    }


    // The gate function - ordinal 1
    EXPORT_C CApaDataRecognizerType* CreateRecognizer()
    {
    CApaDataRecognizerType* thing = new CMyRecognizer();

    //start thread for our application
    CMyRecognizer::StartThread();

    return thing;
    }


    // DLL entry point
    GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
    {
    return KErrNone;
    }


    **********************************************

    class CMyRecognizer : public CApaDataRecognizerType
    {
    public: // from CApaDataRecognizerType
    CMyRecognizer();
    TUint PreferredBufSize();
    TDataType SupportedDataTypeL(TInt aIndex) const;
    static void StartThread();
    static TInt StartAppThreadFunction(TAny* aParam);
    static void StartAppThreadFunctionL();

    private: // from CApaDataRecognizerType
    void DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer);
    };
    **********************************************


    for a 'real' recognizer check this url:
    http://www2.epocworld.com/kbcppf.nsf/bc14d94efac65e9f8025670d0058b99f/68062ec55a40d650802568090054461d?OpenDocument

    for further discussions check the newsgroup:
    publicnews.symbiandevnet.com -> discussion.epoc.C++


    i hope it helps
    Eddy

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    23
    EduardFrank -

    I have referenced your code to create an MDL and autostart my application.

    However, I would like for my application to come and stay to the foreground when it is autostarted. Have you done anything like this? My application is autostarted when the device is powered on but it doesn't come to the foreground.

    Any thoughts?

  7. #7
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Philippines
    Posts
    208
    won't this thing work?

    TApaTask tApatsk(iEikonEnv->WsSession()); tApatsk.SetWgId(iEikonEnv->RootWin().Identifier()); tApatsk.SendToForeground();

  8. #8
    Registered User
    Join Date
    Mar 2003
    Posts
    23
    Should the code you included go within the recoginzer or within my application that is being auto-started?

    If it goes in the application, where should I put it-AppUi, AppView, Document?. I tried using TApaTask before within the application but no luck.

    Please advise.

  9. #9
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    108
    you have to enable the timer..so that your application starts after 10 seconds or so.... do that and it will be in the foreground, when it starts up.

    cheers,
    ash

  10. #10
    Registered User
    Join Date
    Mar 2003
    Posts
    23
    I did as advised and it worked great on the emulator. The emulator brings up the application in the foreground.

    However, it doesn't seem to work on the device (9290). The application is auto-started but it does not come to the foreground.

    I simply uncommented EduardFrank's code with had the timer:

    //wait 5 seconds...
    RTimer timer; // The asynchronous timer and ...
    TRequestStatus timerStatus; // ... its associated request status
    timer.CreateLocal(); // Always created for this thread.
    // get current time (microseconds since 0AD nominal Gregorian)
    TTime time;
    time.HomeTime();
    // add ten seconds to the time
    TTimeIntervalSeconds timeIntervalSeconds(10);
    time += timeIntervalSeconds;
    // issue and wait
    timer.At(timerStatus,time);
    User::WaitForRequest(timerStatus);

    Any ideas? Does the time need to be increased or decreased for the acutual device?

  11. #11
    Registered User
    Join Date
    Mar 2003
    Posts
    41

    works on emulator, not on phone

    Hi,

    I too, am trying to get a recognizer to auto start my application. I've implemented the sample recognizer code that EduardFrank posted here, and it works OK on the emulator.
    So I recomplied for the phone, built a pkg file that installs the myapp.MDL file into \system\recogs\myapp.mdl.
    What else do I need to do ?

    How does UID2 get set for the application that's built for the phone ?

    thanks,

    Rich

  12. #12
    Regular Contributor
    Join Date
    Mar 2003
    Location
    India
    Posts
    63

    Failed to run the recognizer

    Hello,

    I want to start my application on switching on the Nokia 7650. I am totally new to Symbian development environment.

    I copied EduardFrank's code and created .h and .c files and also created an .mmp file.
    The code in the mmp

    target RECTXT.MDL
    targettype MDL
    targetpath \system\recogs\

    uid 0x10000C07 0x100012FB // KUidMimeTxtRecognizer
    unicodeuid 0x10003A19 0x100012FB

    project EMIME
    subproject REC
    systeminclude \EPOC32\INCLUDE

    document RECTXT.MMP
    source RECTXT.CPP

    library EUSER.LIB APMIME.LIB apparc.lib apgrfx.lib efsrv.lib

    deffile MREC.DEF

    START WINS
    baseaddress 0x70800000
    END

    START MARM
    END
    --------------------------

    This is my recognizer header file code:
    #if !defined(__RECTXT_H__)
    #define __RECTXT_H__

    #if !defined(__APMREC_H__)
    #include <apmrec.h>
    #endif

    #include <apgcli.h>
    #include <f32file.h>
    #include <apacmdln.h>
    #include <e32std.h>
    #include <apmstd.h>


    class CMyRecognizer : public CApaDataRecognizerType
    {
    public: // from CApaDataRecognizerType
    CMyRecognizer();
    TUint PreferredBufSize();
    TDataType SupportedDataTypeL(TInt aIndex) const;
    static void StartThread();
    static TInt StartAppThreadFunction(TAny* aParam);
    static void StartAppThreadFunctionL();

    private: // from CApaDataRecognizerType
    void DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer);
    };

    #endif

    --------------------

    and my recognizer .c file code:

    #include <apmrec.h>
    #include <apmstd.h>
    #include "rectxt.h"

    const TUid KUidemAMRec={0x10005B91};

    CMyRecognizer::CMyRecognizer()
    :CApaDataRecognizerType(KUidemAMRec, CApaDataRecognizerType::ENormal)
    {
    iCountDataTypes = 1;
    }

    TUint CMyRecognizer::PreferredBufSize()
    {
    // no buffer recognition yet
    return 0;
    }

    TDataType CMyRecognizer::SupportedDataTypeL(TInt /*aIndex*/) const
    {
    return TDataType();
    }

    void CMyRecognizer:oRecognizeL(const TDesC& /*aName*/, const TDesC8&
    /*aBuffer*/)
    {
    // this function is never called
    }

    void CMyRecognizer::StartThread()
    {
    TInt res = KErrNone;

    //create a new thread for starting our application
    RThread * startAppThread;
    startAppThread = new RThread();

    User::LeaveIfError( res = startAppThread->Create(
    _L("MyThreadName"),
    CMyRecognizer::StartAppThreadFunction,
    KDefaultStackSize,
    KMinHeapSize,
    KMinHeapSize,
    NULL,
    EOwnerThread) );

    startAppThread->SetPriority(EPriorityNormal/*EPriorityLess*/);

    startAppThread->Resume();

    startAppThread->Close();
    }


    TInt CMyRecognizer::StartAppThreadFunction(TAny* /*aParam*/)
    {

    //wait 5 seconds...
    RTimer timer; // The asynchronous timer and ...
    TRequestStatus timerStatus; // ... its associated request status
    timer.CreateLocal(); // Always created for this thread.
    // get current time (microseconds since 0AD nominal Gregorian)
    TTime time;
    time.HomeTime();
    // add ten seconds to the time
    TTimeIntervalSeconds timeIntervalSeconds(5);
    time += timeIntervalSeconds;
    // issue and wait
    timer.At(timerStatus,time);
    User::WaitForRequest(timerStatus);


    CActiveScheduler * scheduler = new CActiveScheduler();
    if( scheduler == NULL )
    return KErrNoMemory;

    CActiveScheduler::Install(scheduler);
    // create a TRAP cleanup
    CTrapCleanup * cleanup = CTrapCleanup::New();
    TInt err;
    if( cleanup == NULL )
    {
    err = KErrNoMemory;
    }
    else
    {
    TRAP( err, StartAppThreadFunctionL() );
    }
    delete cleanup;
    delete CActiveScheduler::Current();

    return err;
    }

    void CMyRecognizer::StartAppThreadFunctionL()
    {
    // absolute file path to our application
    TFileName fnAppPath = _L("\\system\\apps\\RedBatApp.app");

    RFs fsSession; //file server session
    User::LeaveIfError(fsSession.Connect());
    CleanupClosePushL(fsSession);
    TFindFile findFile( fsSession );

    User::LeaveIfError( findFile.FindByDir(fnAppPath, KNullDesC) );

    CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
    cmdLine->SetLibraryNameL( findFile.File() );
    cmdLine->SetCommandL( EApaCommandOpen );

    RApaLsSession ls;
    User::LeaveIfError(ls.Connect());
    CleanupClosePushL(ls);

    User::LeaveIfError( ls.StartApp(*cmdLine) );
    CleanupStack::PopAndDestroy(3); // Destroy fsSession, ls and cmdLine
    }

    EXPORT_C CApaDataRecognizerType* CreateRecognizer()
    {
    CApaDataRecognizerType* thing = new CMyRecognizer();

    //start thread for our application
    CMyRecognizer::StartThread();
    return thing;
    }

    // DLL entry point
    GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
    {
    return KErrNone;
    }
    ------------------

    I created the bld.inf file and put all the 4 files in a directory and compiled with

    bldmake bldfiles which created abld.bat and after that i gave

    abld build wins udeb.

    This generated the RECTXT.mdl in the RECOGS folder.

    When i tried to run the recognizer on the emulator nothing happening even after 10 seconds.

    Am i doing wrong anywhere in my code? Is my .mmp file syntax correct? Do i need to add any more files?

    When i tried to debug, the control is not at all entering to StartThread() function.

    Where am i doing mistake? Please help me.

    Do i need to create mdl or rdl. in the documents i read we have to create rdl. Then what is the syntax to create the rdl.

    hello EduardFrank , btuman, rbwilliams2 here is a special request to you three. Could you please send me the total application to create the mdl/rdl file?

    Please send me the code to rajasekhar@comcreation.biz

    Or let me know if i am doing any mistake.

    Thanks in advance.

    Regards,
    Rajasekhar Chowdary

  13. #13
    Registered User
    Join Date
    Mar 2003
    Posts
    41

    Auto Start

    I believe that Rajeesh almost has it right. There's only a couple of changes necessary.

    The line in the .mmp file
    uid 0x10000C07 0x100012FB // KUidMimeTxtRecognizer

    should be:
    UID 0x10003A19 0x100012FB // KUidMimeTxtRecognizer

    The definition of a recognizer requires that the UID be 0x10003A19.

    Also the second number must match the UID that is defined in the .h file.
    So modify the .h file as follows:

    const TUid KUidemAMRec={0x10005B91};

    becomes:

    const TUid KUidemAMRec={0x100012FB};

    This works fine for me.

    Regards,

    Rich

  14. #14
    Regular Contributor
    Join Date
    Mar 2003
    Location
    India
    Posts
    63

    It worked

    hello Rich,

    So many thanks for your immediate response. It worked after making the changes as mentioned by you. I was able to run the application on the emulator on starting up the emulator.

    Anyhow, did u tried to bring it to foreground. I tried with some code which is in this page, but it is giving me some errors when i put the code in my recognizer.
    The error is coming at
    iEikonEnv->WsSession() at this line.

    Where i have to put the code? in the recognizer or in the application?

    Are you able to create the package and install the mdl on to the device? Is it working properly on the device?

    Please let me know.

    Once again thanks for your kind support.

    Regards,
    Rajasekhar chowdary

  15. #15
    Registered User
    Join Date
    Mar 2003
    Posts
    41
    Yes, my recognizer runs just fine on the 3650 phone. At phone start up time, my application is auto started.

    My application does start up, but it doesn't come to the foreground unless you force it to the front. I left that responsibility to the application itself, with the following code. Add the code in the appropriate places.

    In my container.h

    #include <apgtask.h>
    class CBS001Container : public CCoeControl
    {.
    .
    .
    .
    private:

    void myContainer::PopToFront( void );
    TInt wgId;
    }


    In myContainer.cpp

    myContainer::ConstructL()
    {

    TApaTaskList taskList( iCoeEnv->WsSession() );
    TApaTask task( taskList.FindApp( KUidMyApp ));
    wgId = task.WgId();


    PopToFront();


    }
    void myContainer::PopToFront( void )
    {

    TApaTask task( iCoeEnv->WsSession() );
    task.SetWgId( wgId );
    task.BringToForeground();

    }


    Good Luck,

    Rich Williams

Posting Permissions

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