Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    8

    Question Question, how to avoid Starting (no GUI) Qt Application multiple times?

    Hi ,
    I develop a NON-GUI Qt application for NOkia C05-00 (s60 3-rd Ed FP2 ).
    When i start application onces, its running. When i second time press on app-icon(or open it with an "options"-softbutton), a guess, new "instance" of application starts.
    I'm not sure, I just notice that my aplication transmitts data to server twice every 10 seconds, but it has to do it just once every 10 seconds.
    May be its stupid question but, I'm confused: Is it normal behavior, that two or more instances of the same application can run parallel?

    And how can i avoid starting applicaiton multiple times?


    Thank you in advance,

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,185

    Re: Question, how to avoid Starting (no GUI) Qt Application multiple times?

    Why do you have non-GUI app with Icon ? Basically with GUI apps, the Symbian CAknApplication class makes sure only one application instance is running, so, if you do not want to use the normal application framework, you do need to check yourself, whether there are multiple instances running, and exit the instance if needed

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    8

    Re: Question, how to avoid Starting (no GUI) Qt Application multiple times?

    Hi symbianyucca,
    Thank you for your answer. I followed your explanation and found this http://www.developer.nokia.com/Commu...Qt_application i will try one of the methodes working with QT 4.6.3.

    But can i ask you about no-GUI App with Icon?
    I couldn't find any usefull Information about this, is it possible to have an non-gui app without icon?
    If its possible,then how can i start my application first time?
    My application starts with autostart-feature when your restart Device, so when i will not have any icon, i must turn off the device and start it again? (that my app starts in background). Or there is something i'm missing about non-GUI applications?

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,185

    Re: Question, how to avoid Starting (no GUI) Qt Application multiple times?

    Basically with Symbian the application registration file, does not care whether the exe is GUI or not, anyway, users would find it unusual to have an icon which does not produce any real effect. Thus I would suggest that you do UI application, which is started with the icon click, and inside that application you have options for user to start the app and well as to exit it. In that UI application you also ´could offer settings for auto starting the non-GUI app with device bootup.

  5. #5
    Registered User
    Join Date
    Nov 2012
    Posts
    8

    Re: Question, how to avoid Starting (no GUI) Qt Application multiple times?

    My Problem ist, that one of the requirements for this qt-application was that users should not be able to manipulate the non-gui application. I had first some GUI, to start and stop the application, but later i had to remove it, because it was not more fitting requirements of our cutomers: "device-users should not do anything, everything must work for them in background, automatically". So its difficult for me to find something in the middle between "customers requirements" and "normal and correct execution of the application".

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,185

    Re: Question, how to avoid Starting (no GUI) Qt Application multiple times?

    Basically it would be against rules to have it working that way. Of course if you Symbian sign the sis, you can get it auto starting on boot. as well as auto starting on installation, but as it is against the Symbian signed rules, your account would be disabled for Express signing after they would check the sis file.

    Basically you need to give users options on having the auto start disabled, if they wish to do so, You could of course have password, etc. which would protect the UI application for any settings changing, AFAIK this would satisfy the general rule, as well as protect your use case.

    Also do remember that users can indeed uninstall the app anytime, effectively disabling it.

  7. #7
    Registered User
    Join Date
    Nov 2012
    Posts
    8

    Re: Question, how to avoid Starting (no GUI) Qt Application multiple times?

    Yes, i afraid that application will not pass the rules, and if you also think that app can fail the tests , so i have to speak about going around this requirement, and add GUI for passing validation-test.About pass-protected settings is also a good idea Thank you for your advices.

  8. #8
    Registered User
    Join Date
    Aug 2012
    Posts
    5

    Re: Question, how to avoid Starting (no GUI) Qt Application multiple times?

    Its a typical singelton problem.
    You can use a named QSemaphore (in Symbian this is QSystemSemaphore) - it will only start the first instance of an app:

    QSystemSemaphore sema("unique name", 1, QSystemSemaphore::Open); // named semaphore with only one instance
    QElapsedTimer lockTime;
    lockTime.start();
    if (sema.acquire())
    {
    if (lockTime.elapsed()<100)
    {
    ...
    main activity of your app
    ...
    }
    sema.release();
    }

    Unfortunately this implementation of semaphore has not test if an instance is available like tryAquire.
    But you can start QElapseTimer before you aquire the semaphore and read the elapsed time. If this elapsed time is nearly 0 then you got this semaphore, if not, then your app was blocked because another instance of your app was running. In this case you should exit this instance of your app.
    Last edited by qooApps; 2013-06-02 at 19:27.

Similar Threads

  1. duplicate multiple times of the same (ui designer) view?
    By nire123 in forum Symbian User Interface
    Replies: 0
    Last Post: 2010-02-20, 23:15
  2. Replies: 0
    Last Post: 2009-09-24, 13:30
  3. avoid multiple versions of the same application on the phone
    By pengox in forum Mobile Java General
    Replies: 5
    Last Post: 2007-08-29, 08:45
  4. Why is my app is launched multiple times?
    By mike.b in forum Symbian Tools & SDKs
    Replies: 6
    Last Post: 2006-03-23, 13:02
  5. RFileReadStream::Attach multiple times?
    By kamosoft in forum Symbian
    Replies: 0
    Last Post: 2004-04-19, 12:50

Posting Permissions

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