×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    39

    AutoStart on re-boot - symbian signed

    Hi i have two applications one is UI and NON UI.
    Non-Ui 'll AutoStart on re-boot and it'll be running in background and it'll launch UI app.
    for symbian signed as mentioned in this link Test 6 Auto Start behaviour http://www.developer.nokia.com/Commu...4_Wiki_version
    I have to add functionality for user to enable/disable of auto-start.
    i got this link to create ini file to store settings data. but
    but i am confused when and where i have to add this functionality whether in UI or Non Ui?
    can some body suggest me in this.
    Last edited by divi11; 2012-02-27 at 11:08.

  2. #2
    Registered User
    Join Date
    Nov 2010
    Posts
    59

    Re: AutoStart on re-boot - symbian signed

    From what i understand of your implementation, you might need to read and write the dictionary store both in the UI and non UI app.
    1. You'll have to access the dictionary store in your UI app to implement settings view to show current settings and allow him to update them.
    2. You'll have to access the dictionary store in your non UI app to check the setting (when the phone reboots) and stop itself if the user settings require it to.

    Edit: The question here is do you have a choice ?

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: AutoStart on re-boot - symbian signed

    The trick is that both executables need access to the setting, since the autostarted daemon needs to read it, and the UI needs to alter it.
    1) The simplistic approach is putting the setting file into a "semi-public" folder, into c:\system perhaps (not to be confused with c:\sys). There you can have your own subfolder, and ordinary users will not see the setting file (the built-in File Manager starts browsing in c:\Data as "Phone Memory"). 3rd-party file managers will provide access to the file however.
    2) The more complicated approach is storing the setting in the private folder of the daemon executable, since it needs access to it on every boot. Then altering the setting can be done via a service running in this process, the UI simply connects to it and says what to do with the setting. It is easy to implement if the daemon process is already having an IPC server part. In this case no file manager application will let the users accessing your settings file.

  4. #4
    Registered User
    Join Date
    Nov 2011
    Posts
    39

    Re: AutoStart on re-boot - symbian signed

    thanks to both of you.
    Quote Originally Posted by singh.parminder02 View Post
    Edit: The question here is do you have a choice ?
    i think i dont have choice as you mentioned i have to access from both.

    Quote Originally Posted by wizard_hu_ View Post
    1) The simplistic approach is putting the setting file into a "semi-public" folder, into c:\system perhaps (not to be confused with c:\sys). There you can have your own subfolder, and ordinary users will not see the setting file (the built-in File Manager starts browsing in c:\Data as "Phone Memory"). 3rd-party file managers will provide access to the file however.
    i'll try this one.
    Code:
    void ReadIniFileL(RFs& aFs)
    {
        CDictionaryStore* iniFile = Application()->OpenIniFileLC(aFs);
        RDictionaryReadStream readStream;
        readStream.OpenLC(*iniFile, KDemoStreamUid ); // direct access by UID
        TInt16 i;
        readStream >> i;
        CleanupStack::PopAndDestroy(2); // readStream and iniFile
    }
    how to use this code in non ui app to read settings from .ini?
    sorry if i am asking wrong.

  5. #5
    Registered User
    Join Date
    Nov 2010
    Posts
    59

    Re: AutoStart on re-boot - symbian signed

    how to use this code in non ui app to read settings from .ini?
    Check out the CDictionaryFileStore class. You can use CDictionaryFileStore::OpenL()

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: AutoStart on re-boot - symbian signed

    Given that you need to store 1 bit of data (autostart / do not autostart), I am not sure that dictionary stores and streaming should be really involved. That .ini file magic is better suited for complex data.
    How about
    Code:
    _LIT(KAutoStartSettingFile,"c:\\system\\myapp\\autostart.txt");
    RFs fs;
    TInt err=fs.Connect();
    if(err) "exit" // if File Server is unavailable, the phone is probably dying anyway, so better not start
    RFile file;
    err=file.Open(fs,KAutoStartSettingFile);
    if(err)
    {
        fs.Close();
        "exit" // if the file or its path does not exist, do not autostart
    }
    TBuf8<1> setting;
    err=file.Read(setting);
    file.Close();
    fs.Close();
    if(err || (setting[0]!='Y')) "exit"; // if file could not be read, or read setting is not 'Y', do not autostart
    "start"; // otherwise, autostart is enabled
    And the GUI app can enable or disable it this way:
    Code:
    void SetAutoStartL(TBool aEnable)
    {
        _LIT(KAutoStartSettingFile,"c:\\system\\myapp\\autostart.txt");
        RFs fs;
        User::LeaveIfError(fs.Connect());
        CleanupClosePushL(fs);
        fs.MkDirAll(KAutoStartSettingFile);
        RFile file;
        User::LeaveIfError(file.Replace(fs,KAutoStartSettingFile));
        TBuf8<1> setting;
        if(aEnable)setting.Append('Y');
        else setting.Append('N');
        User::LeaveIfError(file.Write(setting));
        CleanupStack::PopAndDestroy(2); // file, fs
    }

  7. #7
    Registered User
    Join Date
    Nov 2011
    Posts
    39

    Re: AutoStart on re-boot - symbian signed

    means after installing Non-UI and UI app i have to launch UI app(FR,RI) and ask user to enable/disable auto start and while auto start NON UI i have
    to check as you mentioned in above code right?

  8. #8
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: AutoStart on re-boot - symbian signed

    It is up to your application, but that is a viable way, yes.
    The test themselves do not specify if autostart should be disabled by default, so it may be acceptable to deploy that file with a default Y content.

  9. #9
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: AutoStart on re-boot - symbian signed

    How about having this setting whether to enable or disable autostart be placed in 'Settings' application as a 3rd party plugin?

    Atleast in Meego OS this is possible by creating a declarative settings applet which goes into settings application.

    And your UI and non-UI app will react or alter the settings based on the Setting made in phone by user.

    You can relate what i have said above with say - Contacts application.
    You have a Contacts plugin in 'Settings' app in the App menu. You can decide on whether to display phone/sim contacts and other settings from the plugin.

    When you open Contacts app from app menu, it wil set its display and other settings as per the Settings.

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: AutoStart on re-boot - symbian signed

    Recently there is a similar Settings Framework API in the plug-in packs (http://www.developer.nokia.com/Commu...DK_API_Plug-in), however it does not address the storage of the given setting. And the question was about this part of the task.

  11. #11
    Registered User
    Join Date
    Nov 2011
    Posts
    39

    Re: AutoStart on re-boot - symbian signed

    I followed method which is suggested by Wizard_hu in post #6 and its working....
    I have embeded Sis which contains two exe and sis, just i want to know is it possible
    to start particular exe from UI so that application can start and stop running without re-boot?

  12. #12
    Registered User
    Join Date
    Nov 2010
    Posts
    59

    Re: AutoStart on re-boot - symbian signed

    Sure it is possible. Check out this wiki page

  13. #13
    Registered User
    Join Date
    Nov 2011
    Posts
    39

    Re: AutoStart on re-boot - symbian signed

    thanks parminder. I tried Symbian OS v9, RProcess method from the link you mentioned.
    In Installer.Sisx i have Installer.exe and Settings.exe
    I tried with these two
    _LIT(KMyExeFile,"C:\\Data\\Settings.exe");
    _LIT(KMyExeFile,"Settings.exe");
    but getting System error (-1) - Not found in both the cases.

  14. #14
    Registered User
    Join Date
    Nov 2010
    Posts
    59

    Re: AutoStart on re-boot - symbian signed

    Quote Originally Posted by divi11 View Post
    but getting System error (-1) - Not found in both the cases.
    Try the code snippet with the heading Symbian OS v9, for Server or Console application at the same link with KMyExeFile set to "Settings.exe". That should work

  15. #15
    Registered User
    Join Date
    Nov 2011
    Posts
    39

    Re: AutoStart on re-boot - symbian signed

    Code:
    	TThreadId app_threadid;
    	CApaCommandLine* cmdLine; 
    	cmdLine=CApaCommandLine::NewLC();
    	cmdLine->SetExecutableNameL(_L("Settings.exe"));
    	cmdLine->SetCommandL( EApaCommandRun );
    	RApaLsSession ls;
    	User::LeaveIfError(ls.Connect());
    	TInt err=ls.StartApp(*cmdLine,app_threadid);
    	ls.Close();
    here i am not getting any panic but Settings.exe is not running.

    Edit: Sorry its working now. Thanks parminder.
    Last edited by divi11; 2012-02-29 at 06:14.

Similar Threads

  1. how to autostart an application on boot up in Symbian^3
    By tianmuxia in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2010-09-17, 12:12
  2. Reg: autostart app on boot up
    By ishamishra in forum Symbian
    Replies: 4
    Last Post: 2010-05-22, 19:16
  3. autostart an application on boot
    By royalsnn in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 1
    Last Post: 2009-10-08, 14:22
  4. app with no ui and autostart on boot.
    By shrusc in forum Symbian
    Replies: 6
    Last Post: 2008-08-04, 14:30
  5. autostart app on boot
    By nomadph in forum Symbian
    Replies: 1
    Last Post: 2007-10-25, 03:59

Posting Permissions

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