[Cover] [Previous Section] [Next Section] [Index]
Current chapter: Creating a Dynamic HDML Service
Section 27 out of 67 total sections
, Section 7 out of 8 sections in this chapter
Getting UP.Phone preferences
The UP.Phone provides a built-in user preferences service, which maintains user preferences. The user preferences service allows your UP.Link services to access user preferences. It provides the following URLs for this purpose.
|
URL
|
Description
|
device:home:/pref
|
Displays the user preferences card, which allows the user to set preferences.
|
device:home/pref?get=name
|
Gets the value of the preference specified by name. If the preference does not exist, it returns an empty string. For a list of preference names, see the table below.
|
device:home/pref?get=name
&def=value
|
Gets the value of the preference specified by name. If the preference does not exist, it returns the specified value. For a list of preference names, see the following table.
|
Currently, all UP.Phones provide the following preference:
|
Preference
|
Description
|
TZ
|
The time zone, using the Posix timezone specification:
stdoffset[dst[offset],[start[/time], end[/time]]]
|
Individual phone models may provide additional preferences, which you can retrieve. For a list of the device-specific preferences a phone model supports, consult with the phone manufacturer.
IMPORTANT
To test services that access the user preferences service, you must use a real UP.Phone or the UP.Simulator in UP.Link mode. The user preferences service does not work in HTTP direct mode.
For example, the following HDML deck uses a no-display card to retrieve the phone user's time zone preference. It displays the preference in a display card.
<HDML VERSION=3.0>
<NODISPLAY>
<ACTION TYPE=ACCEPT TASK=GOSUB RECEIVE=TZ
DEST=device:home/pref?get=TZ NEXT=#B>
</NODISPLAY>
<DISPLAY NAME=B>
Your timezone preference is:<BR>
$(TZ)
</DISPLAY>
</HDML>
FIGURE 3-3.
Deck that displays the user's time zone preference
Of course, you can also pass the time zone preference back to your service with a query string. The v2clock.cgi example provided with the UP.SDK demonstrates how to use the time zone preference to calculate the current time.
[Cover] [Previous Section] [Next Section] [Index]
Current chapter: Creating a Dynamic HDML Service
Section 27 out of 67 total sections
, Section 7 out of 8 sections in this chapter
Copyright © 1999, Unwired Planet, Inc. All rights
reserved.