×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Question Avoiding multiple instance of same app

    hi,
    I madean app and then i hid it from tasklist , now the problem is when i click on the application icon in the installed apps folder my app is relaunched , so now i have 2 iinstances of my app running simultaneously !! how can i avoid this
    -thks in adv
    -J

  2. #2
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Avoiding multiple instance of same app

    GUI applications avoid this by default, so are we to understand that you have created a GUI-less application (aka "console")? If so, why does it have an icon in the main menu to begin with?
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  3. #3
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: Avoiding multiple instance of same app

    how is it done automatically? im sure the implementation that u have mentioned to do the trick is not searching whether the process is running or not, its sad and bad! , its a gui app...

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,751

    Re: Avoiding multiple instance of same app

    Just to make sure: are you using the HideApplicationFromFSW or something else? How do you see that your application is running in multiple copies?

  5. #5
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: Avoiding multiple instance of same app

    yes im using that ... Its easy to find ...
    I used TFindProcess to find ..it seems the framework checks whether the app is in Tasklist, if not in tasklist it spawns another one .. thats why i said its sad and bad!

  6. #6
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Avoiding multiple instance of same app

    Quote Originally Posted by julie_777 View Post
    yes im using that ... Its easy to find ...
    I used TFindProcess to find ..it seems the framework checks whether the app is in Tasklist, if not in tasklist it spawns another one .. thats why i said its sad and bad!
    Even if that would be true, it would still not be either sad or bad, it would simply be what it is. At some point you have to decide whether you want an app or a daemon, you cannot have the cake and eat it to.

    However, that's no the case. Regardless of your call to HideApplicationFromFSW the application will still be brought to foreground if already running instead of a new process being spawned. If indeed you see what behaviour, you need to look elsewhere for the explanation and give us more details about what you do. And a sample app.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

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

    Re: Avoiding multiple instance of same app

    Quote Originally Posted by julie_777 View Post
    how is it done automatically? .
    by deriving the application class from CAknApplication.

  8. #8
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: Avoiding multiple instance of same app

    @Itomuta, Well if the platform declares that only one instance is active at a moment, Then the platform should check and make it happen .Is it such a pain to check using Tfindprocess to search on the framework side.

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

    Re: Avoiding multiple instance of same app

    Quote Originally Posted by julie_777 View Post
    @Itomuta, Well if the platform declares that only one instance is active at a moment, Then the platform should check and make it happen .Is it such a pain to check using Tfindprocess to search on the framework side.
    Where have you found such a declaration ? Anyway it is all about the CAknApplication base classe's logic, and has nothing to do with task list. and if you do not use CAknApplication based application class instance, then you gotta do it yourself.

  10. #10
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: Avoiding multiple instance of same app

    oki guys .. im using CAknApplication... i didnt find such a declaration but an Forum expert said its handled by default. I can manage it myself .No worries!.

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

    Re: Avoiding multiple instance of same app

    Quote Originally Posted by julie_777 View Post
    oki guys .. im using CAknApplication... i didnt find such a declaration but an Forum expert said its handled by default. I can manage it myself .No worries!.
    Yes indeed, there is no such declaration. That's why you can not find it. And it is indeed handled automatically, provided that you are using the Application framework, and actually deriving the application class from a base class that provides the functionality. simple and easy.

  12. #12
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Avoiding multiple instance of same app

    Well, if you look enough for it, you find it. Not as clearly stated as it should be, in a proper "application lifecycle" document, but we all know that Symbian's documentation is not state of the art ...

    The CAknApplication-derived class:
    • provides the application object expected by the application framework when the application is launched.
    • defines the application properties.
    • creates the CAknDocument derived class if it does not exist yet.
    • if an instance of the application is already running, switches to that instance and exits.
    The above quote is from Framework requirements for GUI applications, a document from Forum Nokia's Nokia Symbian^3 Developer's Library.

    And this behaviour is actually consistent, I verified it last night on S^3 device and S^1 emulator.
    Last edited by ltomuta; 2011-05-23 at 08:43. Reason: Typo
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  13. #13
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: Avoiding multiple instance of same app

    oki im using 3rd edition fp1 .. whre u can have multiple instances on device. i can share a sample app with you if u are interested to install and see it your self.

  14. #14
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,751

    Re: Avoiding multiple instance of same app

    Quote Originally Posted by julie_777 View Post
    I used TFindProcess to find ..
    What do you see with TFindProcess? Are you trying to rename your process?
    What do you see on the screen? Does your application apparenly restart?
    Have you debugged the application? Just to see if it happens to get back to E32Main.

  15. #15
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: Avoiding multiple instance of same app

    I used Tfindprocess to figure out wat was happening,usinf the Next() api i founs that thre are multipleinstances .My steps are like this open the app as usual clicking on app icon, thre is a option to hide the app , then go back to installed apps and click on the aicon again , it starts a new instance creates newu ui and view .. brand new... then i added this test code to find process (TFindProcess , next) , when run first time it says one exists probably becoz it already strted the process before finishing e32main makes sense, then i hid using HideApplFromFSW , then i clicked on app icon again now the Next() finds two instances!! the current one and previous one , This test was done on device 3r editon fp1 no on emulator (emulator is crap) ,

Similar Threads

  1. get another instance of the same object
    By arnab321 in forum Symbian
    Replies: 2
    Last Post: 2011-03-13, 00:02
  2. access 2 instance of same class same time
    By kuddy_abc in forum Symbian
    Replies: 3
    Last Post: 2010-06-08, 03:43
  3. Replies: 8
    Last Post: 2008-08-22, 17:14
  4. Multiple instance of same view.
    By anupid in forum Symbian User Interface
    Replies: 6
    Last Post: 2007-07-26, 08:45
  5. multiple instance of same view
    By anupid in forum Symbian
    Replies: 1
    Last Post: 2007-07-19, 16:35

Posting Permissions

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