Application gone after power on

A

ataha

I'm having a strange and almost undebuggable program. During my
development, my PDA (a Socket SoMo, and previously an HP) is generally
sitting in the cradle and it's powered through the night, so when I
come back in the morning the application is still running and
everything is fine.

However, our sales people take out the PDAs now and the product is
beginning to sell. Customers and salesfolk are finding that
occasionally (once every 50 times or so) when the PDA is powered down,
they power it up and find that the application is just not there. No
exception or anything. It's just gone. Since the application disables
the taskbar and it starts up automatically, this generally means they
are sitting at the today screen and can't do anything. As a temporary
fix, I will write a secondary application that keeps checking every 5
seconds (or on power up) that the primary application is running and
restarts it if it isn't.. but does anyone know how I can try to track
this problem, or if it has been seen before.

Any help would be appreciated.
Taha
 
D

dbgrick

Try adding logging to the application. Persist any shut down or exceptions
to file. Make sure you write the stack strace for exceptions, then when you
experience this issue, you should be able to track it down.

Regards,
Rick D.
 
P

Paul G. Tobey [eMVP]

Where is the EXE stored? I don't know anything about those particular
devices, but, if you're storing the application in the RAM filesystem, of
course, if the battery dies, it's gone. That would be my first guess. You
might also check, perhaps by writing some values to the registry, whether
the registry is also going away at the same time.

Paul T.
 
S

Simon Hart [MVP]

I have seen this on older devices (older Windows Mobile devices). Not sure
why the OS seems to change the Z order, this is probebly a bug or an
application on the device causing it. You'll probebly find it is still
running but just hidden, is this the case? and what ver of Windows Mobile do
you have. You've put the device model but I can't be arsed to look it up to
find out what version it is.
 
A

ataha

Where is the EXE stored? I don't know anything about those particular
devices, but, if you're storing the application in the RAM filesystem, of
course, if the battery dies, it's gone. That would be my first guess. You
might also check, perhaps by writing some values to the registry, whether
the registry is also going away at the same time.

Paul T.

Paul: I don't mean a total power drainage of the device, I mean just a
simple power off, power on, sometimes with a few days in between. Does
the ability of the PDA to reload the running application somehow
degrade with time? Or does it depend on how much the device gets
knocked around? The registry settings are still intact, because I set
some of them in the application and they seem fine even after the
program has been restarted.

Rick: I have given thought to the logfile. It was infact going to be
my next step. I'm not sure it would pinpoint the problem, but it would
at least point me in the right direction.

Taha
 
A

ataha

The folks having the problem have installed the EXE on a card - right?

Hilton

Hilton: No it's installed on the device itself.
I have seen this on older devices (older Windows Mobile devices). Not sure
why the OS seems to change the Z order, this is probebly a bug or an
application on the device causing it. You'll probebly find it is still
running but just hidden, is this the case? and what ver of Windows Mobile do
you have. You've put the device model but I can't be arsed to look it up to
find out what version it is.

Simon: I'm using Windows Mobile 5.0 on a Socket Mobile SoMo 650. I
hadn't thought that it might still be there. I suppose it might. I'll
try to make a call to SetForegroundWindow after I detect power on and
see if that helps. Sometimes when this happens, the screen that is
shown is the File Explorer, and I can restart the application right
away. However, it is quite possible that the new app detects that the
old app is already running, gives it the foreground and quits (so that
only one copy of the app is running).

I'll see if that is the case.
Thanks
Taha
 
P

Paul G. Tobey [eMVP]

The RAM filesystem and the registry storage are essentially the same. It's
possible, I guess, that the OS is telling your application to exit to save
battery when the device is suspended (I doubt that the power is actually
off, ever), and you aren't handling that properly.

Paul T.
 
A

ataha

The RAM filesystem and the registry storage are essentially the same. It's
possible, I guess, that the OS is telling your application to exit to save
battery when the device is suspended (I doubt that the power is actually
off, ever), and you aren't handling that properly.

Hi Tobey.

Thanks for your reply. That is an interesting notion. If we assume
that your theory is correct and the OS is telling the app to exit, is
there any way to prevent my app from exiting? Or should I just try to
use something run like cerunappatevent and launch a small application
each time at power up that will see if my app is running and start it
if it is not?

Taha
 
P

Paul G. Tobey [eMVP]

I'm not a Windows Mobile expert, except to the extent that it overlaps the
underlying OS, Windows CE. None of our devices, which are used in
industrial situations where they are always-on, suspend, so I'm not the best
guy to answer this.

The log file is the right way to answer the question, I think. Of course,
if you can just check the running programs list when the device comes up and
appears to be gone, that will tell you something (if there were three apps
running, including yours, before the suspend, and now there are none, it's
reasonable to assume that at least a soft reboot has occurred; if you're the
only one missing, your code is broken and a log is going to be required, I'd
think). Read through the information about suspend in the appropriate
Windows Mobile SDK and see what you can find.

Paul T.
 
C

Chris Tacke, eMVP

Yes, if the OS requests that you sgut down due to low memory, you get a
windows message that you can intercept. I also think that the Closing event
fires and you can simply set Cancel to true on that.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
A

ataha

Yes, if the OS requests that you sgut down due to low memory, you get a
windows message that you can intercept. I also think that the Closing event
fires and you can simply set Cancel to true on that.

Hi Chris.

Thanks for your response. I don't suppose you know what this windows
message is so I can intercept it? I'll put some logging into onclosing
too.

Thanks for your help.
Taha
 
A

ataha

Hi Chris.

Thanks for your response. I don't suppose you know what this windows
message is so I can intercept it? I'll put some logging into onclosing
too.

Thanks for your help.
Taha

I had a thought here. Before we switched to Socket PDAs, we used to
use HP iPAQs. The iPAQs did something that was vaguely similar. I have
a logout process that happens when you switch the PDA off then on. It
writes out some files, deletes some objects, creates some other ones
and displays the login screen. With the HP, if I began the logout
process immediately after a power on, the application also
disappeared. After trying to figure out what was wrong for a long, I
concluded that maybe the application was trying to do 'too much' after
the power up when the PDA just wasn't ready to handle it yet. I added
a "wait while we log you out" screen, and waited 10 seconds.. and
everything was fine. Could this be what is happening? Could I just be
trying to do too much processing when the PDA is still trying to bring
up hardware and do essential things?

Taha
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top