UP.SDK Developer's Guide

[Cover] [Previous Section] [Next Section] [Index]

Current chapter: Dynamic WML Services
Section 26 out of 61 total sections , Section 8 out of 9 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 service 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 device-specific preferences, consult the phone manufacturer.

For example, the following WML deck retrieves the user's time zone preference and displays it:

<!-- http://foo.com/time.cgi -->
<wml>
<card>
<onevent type="onenterforward">
 <go href="uplink_svc.cgi?svc=pref&amp;nexturl=time.cgi#tz"/>
</onevent>
</card>

<card id="tz">
  <p>
    Your time zone preference is:<br/>
    $(TZ)

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 clock.cgi example provided with the UP.SDK demonstrates how to use the time zone preference to calculate the current time.


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.


[Cover] [Previous Section] [Next Section] [Index]


Copyright © 2000, Phone.com Inc. All rights reserved.
Please send comments and questions to doc-comments@corp.phone.com.