×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    22

    Background process using J2ME

    Is it possible to make a J2ME Application run in the background without much user intervention?

    Better still, can we program an application to run like a deamon process using J2ME.

    Thanks a lot.

  2. #2
    Super Contributor
    Join Date
    Mar 2006
    Posts
    516

    Re: Background process using J2ME

    Hi,

    R u refering to an application such that a network connection is done in the background while a "Please Wait" screen is shown in the foreground. If so this is possible by just using two threads. The first thread does the operation at the back while the second thread shows the please wait scree.

    If u r refering to that two different applications are run one in the foreground and the other in the background then AFAIK this is not possible.

    Wang

  3. #3
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: Background process using J2ME

    Hi prayagnarula,

    You can use MIDP 2.0's Push Registry to have an application that will be activated upon notification. See:

    The MIDP 2.0 Push Registry
    http://developers.sun.com/techtopics...icles/pushreg/

    Also, on Symbian Devices (S60, Series 80, not Series 40) you can background your app and schedule one-time or repeated execution using java.util.TimerTask and java.util.Timer.

    Hope it helps!

    BR,

    Juarez Jr

  4. #4
    Registered User
    Join Date
    Apr 2006
    Posts
    10

    Re: Background process using J2ME

    Is push registry available for OBEX connections also??

    I have read MIDP2.0 Push Registry Specifications in which it is mentioned that in registerConnection method, the connection can be either socket for TCP connections or datagram for UDP connections or sms for messageConnection.....

    But I could not find what would be the URL for Obex Connection.......
    In other words, if I write the foll code, will it work properly???

    ....

    String midletClassName = this.getClass().getName();
    String url = "btgoep://localhost:1234567890AF";
    String filter = "*";
    private SessionNotifier notifier;
    private Connection conn;

    try {
    // Open the connection.
    notifier = (SessionNotifier) Connector.open(url);
    PushRegistry.registerConnection(url, midletClassName, filter);

    // Now wait for inbound network activity.
    conn = notifier.acceptAndOpen(handler);

    }
    catch(Exception e) {
    e.printStackTrace();
    }

    ...

    Please reply.

    Thanks in advance.

  5. #5
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: Background process using J2ME

    Hi ramita,

    I don't know the answer (i'd like to find out) but note that not all JME devices implementing JSR-82 support OBEX...regarding BT PR let's see what the Nokia Experts are going to say.

    BR,

    Juarez Junior

  6. #6
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    105

    Re: Background process using J2ME

    Actually im quite interested to see if you can get a background process running in J2ME. This can obviously be done in Symbian and Python (to an extent) but the main reason for me posting is to *bump* and so I get email notifications

  7. #7
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: Background process using J2ME

    Hi rexwal,

    Please do not hijack other user's threads, create your own, ok? And also please do not crosspost (people have already replied elsewhere to your question)...

    BR,

    Juarez Junior

  8. #8
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    105

    Re: Background process using J2ME

    Well, I didnt hijack the thread and the question hasnt been answered! I just *bumped* the thread so hopefully someone would post an answer or a link to the answer. What was posted was information about the push-registry but this doesnt run like a daemon process. Daemon processes are more like symbian and to an extent python background scripts.

    So I didn't hijack the thread or crosspost, I was just actively seeking if there was an answer to "is there a background j2me process?" which is the topic of the post and not information about pushregistry

  9. #9
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: Background process using J2ME

    Hi rexwal,

    It seems you did hijack it, i replied to other subjects before your post, i'm afraid of the subject being different then...that simple

    Anyway, i'll try to help you

    "is there a background j2me process?"
    AFAIK as of today the only option you have is the PushRegistry mechanism, if you don't know which use cases are covered by PR just read the article i provided before on this same thread. I assume you know PR on its entirety.

    Note that on current Nokia Series 40 devices (NOKIA OS) you'll never address your requirement, so stick with S60, ok?

    Hope it helps anyway!

    Best Regards,

    Juarez Junior

  10. #10
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    105

    Re: Background process using J2ME

    I guess the only real option is to use Symbian then since pushregistry is kind of like a background process but it still hijacks the JVM when it is running and also can be seen as an application!

    I was hoping to see if there was a way to create a java application that will run in the background and thusly be invisible to the user (: but I guess it is really down to using Symbian C++ then!

    oh well im done hijacking, thanks juarez =)

  11. #11
    Registered User
    Join Date
    Aug 2006
    Location
    PARIS, FRANCE
    Posts
    11

    Re: Background process using J2ME

    It seems to be not possible to put the midlet in background with a Nokia device.
    But with a Sony-Ericsson , you can use display.setCurrent(null) to hide the User Interface
    Quang-Hai PHAN

  12. #12
    Super Contributor
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: Background process using J2ME

    it is definitly possible
    but only on s60 phones.
    you just go :

    Display.getDisplay(myMidlet).setCurrent(null)

    and your midlet is gone, but still active.
    moreover, if yo start your app, and press the menu button, you'll exit the app to the menu, but the app will still be running in background

    again, this only works on s60

  13. #13
    Nokia Developer Champion
    Join Date
    Feb 2006
    Location
    Santiago, Chile
    Posts
    83

    Re: Background process using J2ME

    As said before, nokia s40 apps can't go into background, but in other platforms (like Nokia S60, Sonyericsson J2 and up, Siemens C65-family) you can do it by using display.setCurrent(null).

    As a side note, when you request the platform to navigate to a URL, in a S40 you have to close the app. Only after closing will the browser go to the URL. That's because only one app can be running at any time.

  14. #14
    Registered User
    Join Date
    Jun 2005
    Posts
    9

    Re: Background process using J2ME

    This is all fine, but on the N93 (which I'm developing for atm) there's a problem: When I enter the camera on the phone, it most often closes all other applications that run in the backgorund (this includes java-apps, phones own apps, sis apps etc)

    Is there any way to avoid this?

    What I need is a program running in the background, uploading content to a server once in a while. This works perfectly except for the behaviour described above (my java app is quitted/removed when the camera is opened) - and to make it even worse, the files I will transfer now and then are files.... recorded from the camera

    hope you can help me out on this

  15. #15
    Registered User
    Join Date
    Aug 2005
    Posts
    44

    Re: Background process using J2ME

    Sending a Java Application to background is not a good solution as there are many factors which might close the application.
    One of them like you said is camera...other might be a phone call...or worse still the user starts another java application...

    As regards to Push Registry in Bluetooth this thread might come in handy

    http://discussion.forum.nokia.com/fo...ad.php?t=64847


    regards
    nimish

Similar Threads

  1. Replies: 7
    Last Post: 2008-08-07, 15:24
  2. J2ME networking in the background
    By sttng359 in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2006-04-27, 08:45
  3. Running as a background process
    By Kulendra in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2005-05-27, 05:36
  4. Running a process in Background
    By vcribe in forum Symbian User Interface
    Replies: 2
    Last Post: 2005-04-26, 06:40
  5. Series 60 - Power button, and starting process in background
    By pandeya in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2004-11-01, 09:04

Posting Permissions

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