Skip to main content

Running a Midlet on phoneME, accessing application in background

5 replies [Last post]
jacek_lewand
Offline
Joined: 2010-09-13
Points: 0

Hi

I am running my app with PhoneME on Windows Mobile 6.5 (HTC HD2). I run my application using lnk file as follows:

255#"\Program Files\pMEA FP\bin\cvm.exe" -f "\Storage Card\workspace\demo\run_config.txt"

and I use run_config.txt to specify run parameter as follows:

-Xmx2m -Dmicroedition.profiles=MIDP-2.0 -Dsun.midp.library.name=midp "-Xbootclasspath/a=\Program Files\pMEA FP\lib\jsr82.jar" "-Dsun.midp.home.path=\Program Files\pMEA FP\midp\midp_wince" -Dcom.sun.midp.mainClass.name=com.sun.midp.main.CdcMIDletSuiteLoader sun.misc.MIDPLauncher -midppath "\Program Files\pMEA FP\midp\midp_wince\classes" -suitepath "\Storage Card\workspace\demo\demo.jar" -1 testMidlets.TempClient

Everything is fine until I press X in the top right hand corner when I want to use other phone functions e.g. phone. If I want then to come back to my currently running j2me application by pressing lnk, it creates new instance of my app while the old one is still there running (I can see it in TaskManager but I can't access it in any way). This is not what I want to run.

Is there any way I can bring back on my screen and continue where I stopped with my already running app?

Any help?
Mayby some conditional lnk that either run new instance either bring back running app?

Many thanks in advance,
Jacek

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Hinkmond Wong

Hi Davy P.,

I'm guessing this question might be for you. In your Windows Mobile
implementation, do you catch the close window event (after clicking on
the "X" close button in the Windows Mobile window frame), then call
System.exit() in the pMEA porting layer?

(That's probably not happening is what I'm guessing)

Thanks,
Hinkmond

On 9/13/2010 9:45 AM, phonemeadvanced@mobileandembedded.org wrote:
> Hi
>
> I am running my app with PhoneME on Windows Mobile 6.5 (HTC HD2). I run my application using lnk file as follows:
>
> 255#"\Program Files\pMEA FP\bin\cvm.exe" -f "\Storage Card\workspace\demo\run_config.txt"
>
> and I use run_config.txt to specify run parameter as follows:
>
> -Xmx2m -Dmicroedition.profiles=MIDP-2.0 -Dsun.midp.library.name=midp "-Xbootclasspath/a=\Program Files\pMEA FP\lib\jsr82.jar" "-Dsun.midp.home.path=\Program Files\pMEA FP\midp\midp_wince" -Dcom.sun.midp.mainClass.name=com.sun.midp.main.CdcMIDletSuiteLoader sun.misc.MIDPLauncher -midppath "\Program Files\pMEA FP\midp\midp_wince\classes" -suitepath "\Storage Card\workspace\demo\demo.jar" -1 testMidlets.TempClient
>
> Everything is fine until I press X in the top right hand corner when I want to use other phone functions e.g. phone. If I want then to come back to my currently running j2me application by pressing lnk, it creates new instance of my app while the old one is still there running (I can see it in TaskManager but I can't access it in any way). This is not what I want to run.
>
> Is there any way I can bring back on my screen and continue where I stopped with my already running app?
>
> Any help?
> Mayby some conditional lnk that either run new instance either bring back running app?
>
> Many thanks in advance,
> Jacek
> [Message sent by forum member 'jacek_lewand']
>
> http://forums.java.net/jive/thread.jspa?messageID=482537
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
> For additional commands, e-mail: advanced-help@phoneme.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

davyp
Offline
Joined: 2007-01-03
Points: 0

Hi Hinkmond, Jacek,

Windows Mobile has modified the behavior of the X close button to keep the application
running in the background. I don't like it either, and I usually install a third party application
to really close applications (so that the VM gets the WM_CLOSE message).

About starting multiple applications:
Yes, I know. Normally when you run a binary (say cvm.exe) you check whether there is an
application running with a window having the same name. If so, you set the focus to this
window and you quit. Unfortunately, it is not because you run cvm.exe twice that you are
running the same midlet. Previously, I only ran once cvm.exe instance, but people complained
about it. So I modified it, and now I have a request for the opposite behavior.

Ideally, I would have to check which midlet the other instance is running, but this is not
straighforward or easy to do.

However, if you go to the Task Manager, you should be able to activate the previous instance
without any problem (tapping on the entry should set the focus again on the CVM.exe instance).

Davy

> Hi Davy P.,
> 'm guessing this question might be for you. In your
> Windows Mobile
> implementation, do you catch the close window event
> (after clicking on
> the "X" close button in the Windows Mobile window
> frame), then call
> System.exit() in the pMEA porting layer?
>
> (That's probably not happening is what I'm guessing)
>
> Thanks,
> Hinkmond

Hinkmond Wong

Hi Davy,

Thanks for the reply. This makes sense now.

Hinkmond

On 9/13/2010 12:27 PM, phonemeadvanced@mobileandembedded.org wrote:
> Hi Hinkmond, Jacek,
>
> Windows Mobile has modified the behavior of the X close button to keep the application
> running in the background. I don't like it either, and I usually install a third party application
> to really close applications (so that the VM gets the WM_CLOSE message).
>
> About starting multiple applications:
> Yes, I know. Normally when you run a binary (say cvm.exe) you check whether there is an
> application running with a window having the same name. If so, you set the focus to this
> window and you quit. Unfortunately, it is not because you run cvm.exe twice that you are
> running the same midlet. Previously, I only ran once cvm.exe instance, but people complained
> about it. So I modified it, and now I have a request for the opposite behavior.
>
> Ideally, I would have to check which midlet the other instance is running, but this is not
> straighforward or easy to do.
>
> However, if you go to the Task Manager, you should be able to activate the previous instance
> without any problem (tapping on the entry should set the focus again on the CVM.exe instance).

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

jacek_lewand
Offline
Joined: 2010-09-13
Points: 0

Hi Davy,

Thanks for your answer but I didn't realise that in Task Manager I have to double tap the app to bring it back. No I know! :) However, this is some solution to my problem.

But out of curiosity, do you have any example how to check whether this midlet is already running in cvm.exe when calling it using lnk and instead of running new to focus on already running one? Or I got it wrong and this is not possible?

Thank you,
Jacek

davyp
Offline
Joined: 2007-01-03
Points: 0

Hi Jacek,

Checking whether a midlet already runs and changing window focus, is something that should be
done within the phoneME VM. There is not much you can do about it in the midlet itself.

Unfortunately, you cannot get detailed properties of applications that are running. Ideally, I would
need to know the command line parameters of another instance of the cvm.exe executable, but I
have not found a way to do so.

Davy