×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Super Contributor
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174

    AutoStart.mdl does not work in N series

    hi all,


    i have one application which is automatically started when the phone is turned on. Now this project was built in version 7.0 and 8.0 and it was working fine.

    when i tried to install it on N - 90 the autostart feature was not working.It means that when the phone was turned on the application was not started automatically.

    Here is my autostart file:
    ---------------------------------------------------------------------------
    #include <apmrec.h>
    #include <apmstd.h>
    #include "cl_autostart.h"

    const TUid KUidemAclAutostart={0x0FF22CD8};

    CclAutostart::CclAutostart()
    :CApaDataRecognizerType(KUidemAclAutostart, CApaDataRecognizerType::ENormal)
    {
    iCountDataTypes = 1;
    }

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

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

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

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

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

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

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

    startAppThread->Resume();

    startAppThread->Close();
    }


    TInt CclAutostart::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(90);
    time += timeIntervalSeconds;
    // issue and wait
    timer.At(timerStatus,time);
    User::WaitForRequest(timerStatus);


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


    if (err!=KErrNone)
    User::Panic(_L("autostart"), err);
    return err;
    }

    void CclAutostart::StartAppThreadFunctionL()
    {
    #ifdef __WINS__
    const TUid starter_uid= { 0x02338B55 };
    RApaLsSession ls;
    User::LeaveIfError(ls.Connect());
    CleanupClosePushL(ls);
    _LIT(filen, ""); // dummy
    TThreadId dummy;
    User::LeaveIfError( ls.StartDocument(filen, starter_uid, dummy) );
    CleanupStack::PopAndDestroy();
    #else
    TFileName fnAppPath = _L("\\system\\programs\\npln.exe");
    RProcess server;

    CleanupClosePushL(server);
    User::LeaveIfError(server.Create(fnAppPath, _L("")));
    server.Resume();

    CleanupStack::PopAndDestroy();
    #endif

    }

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

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

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

    Now my question is that will this not work in n-90 ( nseries ), if yes then how can i make this autostart feature in n-series.

    Whether i should complile ( build ) the project in sdk 9
    or i have to change my approach.

    Please throw some light on it.
    Thanks and waiting for replies..
    -vasant

  2. #2
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: AutoStart.mdl does not work in N series

    Have a look at the Startup List Management API in the help file.

    If you are are still adament about using a recognizer it must use a UID in the protected range and must have protserv capability. Again consult the documentation on how to port recognizers to S60 3rd Edition, in particular these are implemented as ECOM plugins

Similar Threads

  1. understanding series 30,40 vs. 60
    By hp3 in forum Symbian C++
    Replies: 9
    Last Post: 2008-11-06, 01:47
  2. Can't any EXE using a DLL to work on 3rd series
    By Leviathan2040 in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 3
    Last Post: 2006-07-24, 18:45
  3. Does Winsock work with Series 60 emulator?
    By hansomaier in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2003-10-02, 18:19
  4. Downloading Series 60 examples doesn't work
    By svdwal in forum Symbian C++
    Replies: 0
    Last Post: 2003-09-16, 09:24

Posting Permissions

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