I implemented the feature memory, and I'm storing my settings in application preferences. However, I wanted to check that I'm doing it correctly, as my device is resetting itself on me, which seems to suggest I'm doing some memory operations incorrectly. And I haven't quite figured out the source of the problem.

//The first time I need the preferences I do:
if(FtrGet(appFileCreator, 1, (UInt32 *)&prefs) != 0)
{
FtrPtrNew(appFileCreator, 1, 32, &newPrefs);
PrefGetAppPreferences(appFileCreator, (UInt16)0, &prefs, &prefsSize, true);
DmWrite(newPrefs, 0, &prefs, prefsSize);
}


//When I'm done
  PrefSetAppPreferences(appFileCreator, 0, 1, &prefs, sizeof(prefs), true);

Is that correct? Do I need to add a Dmwrite after that to save it?
At 05:38 PM 6/9/2004, you wrote:

I have a background app (single segmented) that wakes up periodically (using alarms) and performs a short task, and then goes back to sleep. There's a global object that I'm using that maintains some data. I understand that you can't have globals when responding to a reset launch code. What are the rules around using globals? Are there other occasions when it's not allowed?


Most situations, other than being the foreground application, disallow access to globals. This sounds like a good candidate for being stored in feature memory where your app can retrieve a pointer to it via FtrGet.


-- Ben Combee, DTS technical lead, PalmSource, Inc. Read "Combee on Palm OS" at http://palmos.combee.net/




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

Reply via email to