View Source

h2. Overview
_Since 4.0_

The mobi:geolocation component uses the HTML5 geolocation API to capture the user's geolocation data, including latitude, longitude, direction, and altitude. The user is asked for permission to provide this information, as soon as the page is loaded. Once this information is captured it can be sent to the server by simply submitting the form.

h2. Getting Started

To use the Geolocation component, put the mobi:geolocation tag inside a form and bind its attributes to backing bean properties where the captured information is to be stored. Also add a means of submitting the form, so that the captured information can be uploaded to the server.

{code:xml}
<h:form>
<mobi:geolocation id="geolocation"
latitude="#{bean.latitude}"
longitude="#{bean.longitude}"
altitude="#{bean.altitude}"
direction="#{bean.direction}" />
<h:commandButton value="Submit" />
</h:form>
{code}

h2. Attributes

{tip:title=TagLib Documentation}This section covers attributes involved in the typical use-cases for this component. For reference, the complete taglib documentation for this component is available [here|http://res.icesoft.org/docs/v4_latest/mobi/tld/].{tip}

{panel}
The *latitude* attribute is where the user's latitude is going to be saved (in decimal degrees).
{panel}

{panel}
The *longitude* attribute is where the user's longitude is going to be saved (in decimal degrees).
{panel}

{panel}
The *altitude* attribute is where the user's altitude is going to be saved (in meters).
{panel}

{panel}
The *direction* attribute is where the user's direction is going to be saved (in degrees from the North).
{panel}

h2. Event Listeners

None.

h2. Client Behavior Events

None.

h2. JavaScript API

None.

h2. Keyboard Support

None.

h2. Known Issues

None.

h2. Additional Resources


h4. Sample Applications

This component appears in the following ICEfaces sample applications:

* *[ICEfaces Mobile Showcase|http://icefaces-showcase.icesoft.org/showcase-mobile.jsf]*

h4. Tutorials

This component appears in the following ICEfaces tutorials:

*None*