×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    150

    midlet that uses concurrency

    hi Friends,

    I can send to background a midlet that uses concurrency?

    thanks

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

    Re: midlet that uses concurrency

    This is very device dependent. Many devices have no concept of "running in the background". There is no specific mechanism for putting your application into the background. One technique is:

    Code:
    Display.getDisplay(this).setCurrent(null);
    However, there is no guarantee that this will have the effect you want.

    Cheers,
    Graham.

  3. #3
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: midlet that uses concurrency

    Just adding to the lines posted by Grahm,
    There is no background MIDlet support on Series 40 phones..however you can do so on the Series 60.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  4. #4
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    150

    Re: midlet that uses concurrency

    hi,

    help,

    I am developing an application that receives data from GPS and send them to a server using a TCP connection
    I need to run in background already got running in the background but when you start a thread communication for socket the application terminates.
    Code:
    package co.com.widetech.mobile.reporter;
    
    import co.com.widetech.virtualmachine.GPS.*;
    import javax.microedition.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.util.*;
    
    public class MainMidlet extends MIDlet {
        private  ServicesClient clnt = new ServicesClient();
        private Display display;    // The display for this MIDlet
        private Form form; // The form used to report all the results.
    
    
        public void startApp() throws MIDletStateChangeException {
            try{
                if (display == null) {
                    display = Display.getDisplay(this);
                    display.setCurrent(form);
                }           
    
            }
            catch(Exception e) {
                    System.out.println("Excepción durante startApp()");
                    e.printStackTrace();
                    //  If some kind of transient error ocurrs, throw a
                    //  MIDledStateChangeException.
                    throw new MIDletStateChangeException("Error iniciando...");
             }
             pauseApp();
             notifyPaused();
        }
    
        public void pauseApp() {
            
             clnt.startServices();
             display=null;
        }
    
        public void destroyApp(boolean uc)  {
            System.out.println("destroyApp llamado");
            display = null;
       }
    }
    In the method the pauseApp() start position and communication services, when you try to start the communication terminates the application.

    thanks
    Last edited by widetech1; 2009-04-06 at 03:55.

  5. #5
    Nokia Developer Champion
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: midlet that uses concurrency

    Quote Originally Posted by widetech1 View Post
    hi,

    help,

    I am developing an application that receives data from GPS and send them to a server using a TCP connection
    I need to run in background already got running in the background but when you start a thread communication for socket the application terminates.
    Code:
    package co.com.widetech.mobile.reporter;
    
    import co.com.widetech.virtualmachine.GPS.*;
    import javax.microedition.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.util.*;
    
    public class MainMidlet extends MIDlet {
        private  ServicesClient clnt = new ServicesClient();
        private Display display;    // The display for this MIDlet
        private Form form; // The form used to report all the results.
    
    
        public void startApp() throws MIDletStateChangeException {
            try{
                if (display == null) {
                    display = Display.getDisplay(this);
                    display.setCurrent(form);
                }           
    
            }
            catch(Exception e) {
                    System.out.println("Excepción durante startApp()");
                    e.printStackTrace();
                    //  If some kind of transient error ocurrs, throw a
                    //  MIDledStateChangeException.
                    throw new MIDletStateChangeException("Error iniciando...");
             }
             pauseApp();
             notifyPaused();
        }
    
        public void pauseApp() {
            
             clnt.startServices();
             display=null;
        }
    
        public void destroyApp(boolean uc)  {
            System.out.println("destroyApp llamado");
            display = null;
       }
    }
    In the method the pauseApp() start position and communication services, when you try to start the communication terminates the application.

    thanks
    I think the problem is display = null;
    If u want to set the application running at background then use
    display.setCurrent(null);

    hope this makes some sense to u.
    thanks,
    jitu_goldie..

    KEEP TRYING..

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

    Re: midlet that uses concurrency

    Also, you may need to setCurrent() to something that is not null, before you set it to null.

    And: there is no guarantee that pauseApp() will be called when the application goes into the background. In fact, on many phones, pauseApp() is never called.

    Cheers,
    Graham.

Similar Threads

  1. calling midlet from midlet throws SecurityException on 6600
    By brianpegan in forum Mobile Java General
    Replies: 3
    Last Post: 2010-10-25, 05:31
  2. image full screen
    By Morbidick in forum Mobile Java General
    Replies: 8
    Last Post: 2008-12-04, 04:16
  3. 技术文档:MIDP 2.0安全机制 与 MIDlet 数字签名
    By wotrust in forum [Archived] Other Programming Discussion 关于其他编程技术的讨论
    Replies: 0
    Last Post: 2006-12-30, 07:42
  4. 'Response Unknown' when downloading midlet
    By Weevil in forum Mobile Java General
    Replies: 3
    Last Post: 2004-05-30, 17:01
  5. How to create two instances of midlet
    By marquito99 in forum Mobile Java General
    Replies: 0
    Last Post: 2004-04-30, 01:33

Posting Permissions

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