David Fedor wrote:
If your application isn't running, and isn't in the ROM, then you probably shouldn't use AlmSetProcAlarm. That routine takes a pointer to your function, so it is your duty to make sure your code will always be at the location you gave. That's easy while you're running, but when you quit, there's a lot of things you need to start to worry about:
- you have to prevent the user from deleting your database (that's the DmDatabaseProtect bit)
- you have to prevent the memory chunk from moving in memory (in 5.x you could usually do this by keeping the code resource locked, but there are issues which could arise e.g. with NVFS systems unless they hacked around that.)
- you have to implement some way to unregister & unprotect your app so the user can delete it (in the obviously unlikely case that they don't want your fine software any more)
- there are probably other pitfalls that don't come to mind right now
In short, it is much easier to use a launch code if you're not running, and besides, you don't really gain much by going the ProcAlarm route anyway, unless you're a part of the ROM.
Hi David,
I really would like to use the Launchcode-Alarm stuff, but unfortunately it keeps the system away from going to switch off the screen, at least.
My app controls the backlight. To be able to detect the presence of power, I have to poll in a regulary intervall (5 secs) the pluggedIn argument of SysBatteryInfo. I do it only when the OS notifies my, that the device is put into the cradle. But there are situations when the device is in the cradle but no power is connected. I want to prevent the device from going to full backlight then. But having the screen turned on then is also not very suitable.
The app already handles the problem of application delete and application update by hotsync.
But anyway, thank you very much for the detailed infos. I will add the lock for the code resource, and will close my eyes over the possible pitfalls which still could arise then.
One small question still: will the OS unlock my code resource automatically at app quit, if the database isn't protected anymore?
Thank you, Henk
-- ------------------------------------------------------------------------- Henk Jonas Palm OS � certified developer
[EMAIL PROTECTED] www.metaviewsoft.de -------------------------------------------------------------------------
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
