×

Discussion Board

Results 1 to 11 of 11

Thread: Destroy Apps

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    14

    Cool Destroy Apps

    Hi All

    I am developing an application in whuich am tracing each and every flow.

    My doubt is to exit from the application user has press an exit command or inbuit exit button in mobile.

    for both the case if any one of this happens application itself need to hit the server with specified url before getting exit.

    How can do this?

    Am trying the bellow code but its not work for both condition.
    public void destroyApp(boolean unconditional)
    {


    String logout_url = getCorrespondURL("Logout", "");
    HitServer(logout_url);
    notifyDestroyed();

    }

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: Destroy Apps

    Whats in HitServer(logout_url); is it a thread where you make a server call?

    You are calling destroyApp(true or false)

    You need to wait till this server call completes, before calling notifyDestroyed();

    thanks,
    ~Amitabh

  3. #3
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Destroy Apps

    On most devices, destroyApp() will be called if the user presses the "END" key (the red one) to close the application. However, you should not block for a long period of time in this method. If you do not return promptly, the device might choose to terminate your application without further notice. Connecting to a server is far too time consuming to perform in this situation. I recommend you redesign your application so that you no longer have this requirement.

    Graham.

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: Destroy Apps

    On some devices, you will even see that DestoryApp() is not atall called and the application closes as soon as the red key is pressed.

    You may implement session time out on server for logout, so that even if the app is closed w/o logout, the servers automatically logs it out after sometime.

    thanks,
    ~Amitabh

  5. #5
    Registered User
    Join Date
    May 2010
    Posts
    14

    Re: Destroy Apps

    Quote Originally Posted by im2amit View Post
    Whats in HitServer(logout_url); is it a thread where you make a server call?

    You are calling destroyApp(true or false)

    You need to wait till this server call completes, before calling notifyDestroyed();

    thanks,
    ~Amitabh
    ya HitServer(logout_url) connect to server.
    and am calling destroyApp(true);
    what is the difference between destroyApp(false) and destroyApp(true);

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    14

    Re: Destroy Apps

    Quote Originally Posted by im2amit View Post
    On some devices, you will even see that DestoryApp() is not atall called and the application closes as soon as the red key is pressed.

    You may implement session time out on server for logout, so that even if the app is closed w/o logout, the servers automatically logs it out after sometime.

    thanks,
    ~Amitabh
    Thanks for your reply amit
    But could you tell me how can implement session time out on server.

    do i need to calculate the elapsetime between server call.
    if server doesnt call for certion period i need to logout right?

  7. #7
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: Destroy Apps

    But could you tell me how can implement session time out on server.

    do i need to calculate the elapsetime between server call.
    if server doesnt call for certion period i need to logout right?
    Yes, you are correct. On very successful login you need to give a token (some thing like OAuth standard token) which has the timestamp in it after which it will expire, this token should be part every server request and if the current time on the server is more the expire timestamp on the request token.. client will be termed as logout and will get 401 response from the server.

    If you want a very standard server side authentication system on your server, read about OAuth on google.

    thanks,
    ~Amitabh

  8. #8
    Registered User
    Join Date
    May 2010
    Posts
    14

    Cool Re: Destroy Apps

    If i press Hang on key on mobile whether it will call destroyApp or not
    in Nokia series40 supernova my apps is getting exited if i press the red key.
    I think its not calling DestroyApp method.
    so is there any possibilty of making it to call destroyapp?

  9. #9
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: Destroy Apps

    Hello sivaji_boss,

    in the application, you could implement a specific Exit-command and associate destroyApp() with that, f.ex.:


    Command c;
    ..
    c=new Command("Exit", Command.EXIT, 1);
    ..

    public void commandAction(Command cmnd, Displayable dsplbl) {

    if (cmnd==c){

    destroyApp(true);
    notifyDestroyed();

    }

    }


    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  10. #10
    Registered User
    Join Date
    May 2010
    Posts
    14

    Re: Destroy Apps

    Thanks r2j7

    Actually i need to implement both the case 1. exit command
    2. for Hang on key also
    one more thing i using canvas not midlet.
    That exit command type implementation is working fine for me.
    But the problem is on second condition.
    Could you suggest me to reslove the probs if that is possible?

  11. #11
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Destroy Apps

    Quote Originally Posted by sivaji_boss View Post
    I think its not calling DestroyApp method.
    Why do you think this?

    Again, if you attempt to do anything time-consuming in destroyApp(), it won't happen on a red-key exit. destroyApp() will be permitted to run only for a short time.

    Graham.

Similar Threads

  1. [help][nokia 5800] Java apps from memory card after hard reset!
    By cientista99 in forum Mobile Java General
    Replies: 0
    Last Post: 2009-12-30, 18:04
  2. Problem in removing j2me apps on nokia navigator.
    By either1 in forum Mobile Java Games
    Replies: 0
    Last Post: 2009-12-24, 02:52
  3. Replies: 0
    Last Post: 2009-06-12, 03:54
  4. Is USA market for J2ME evaporating?
    By pcarew in forum Mobile Java General
    Replies: 12
    Last Post: 2005-10-15, 02:51
  5. set apps to be run background manually
    By Rx-lee in forum Symbian
    Replies: 2
    Last Post: 2004-09-14, 08:58

Posting Permissions

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