You need to call SysNotifyRegister with the cardNo and dbID of the your
app not the apps which you want to track. So you'll receive a
notification when any and all apps exit. In your notification handler,
you'll need to compare the dbID in the notification with thoses of the
apps you are tracking.

Mark 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Thursday, April 06, 2006 9:35 AM
To: Palm Developer Forum
Subject: Registering for notifications

I am new to Palm programming and I try to develop an application which
keeps track of how many times certain applications stored on my handheld
are launched. To do so, I follow these steps:

1. I get the card number and database ID of the applications I want to
track using DmGetNextDatabaseByTypeCreator(true, stateInfoP, 'appl',
'xxxx', true, &cardNo, &dbID) (where 'xxxx' is the 4 letter creator ID
of the application I want to track, not the application I try to
develop). I make sure that the function returns errNone and it always
does.
2. I then register to receive notifications from the applications for
which I just got the card number and database ID using
SysNotifyRegister(cardNo, dbID, sysNotifyAppQuittingEvent, NULL,
sysNotifyNormalPriority, NULL). I make sure that the function returns
errNone and it does.
3. I added code in the PilotMain to handle the sysAppLaunchCmdNotify
launchcode so that my application's preference is updated during a
sysNotifyAppQuittingEvent event. 

Unfortunately, my application's preference is never updated which tells
me that my application never receives the notifications. Besides, when I
close and restart my application, I should get the
sysNotifyErrDuplicateEntry error when I register the other applications
again (to indicate that my application is already registered to receive
notifications from the other applications) but I don't (I get the
errNone instead).

Can anyone tell me what I am doing wrong? Thanks.

--
For information on using the PalmSource Developer Forums, or to
unsubscribe, please see http://www.palmos.com/dev/support/forums/

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to