Attempts to locate the current Veriplace user, if a location isn't already present in the current state.

Namespace:  Veriplace.Web
Assembly:  Veriplace.Client (in Veriplace.Client.dll) Version: 1.6.0.11143 (1.6.0.0)

Syntax

C#
public void RequireLocation()
Visual Basic (Declaration)
Public Sub RequireLocation
Visual C++
public:
void RequireLocation()

Remarks

If you haven't already identified the user or obtained location permission, then this calls RequireUser()()() and/or RequireGetLocationPermission()()() first in the correct order.

If this method returns with no exceptions, the location information is now in the Location property.

Either the user discovery step or the permission step may cause a redirect to the Veriplace site. When Veriplace redirects back to your application, it will be to the same URL and with the same HTTP parameters as the initial request, but with an additional token to indicate that the location is now available. You do not need to check for this token; just call RequireLocation() as you did before, and this time the method will return normally.

Since it can take a noticeable amount of time to acquire location (if a new GPS fix is required), by default all location requests are done asynchronously on a separate thread. This allows you to give the user some feedback in the meantime, such as a "please wait" page. Veriplace handles this by throwing a WaitingException, which contains a callback URL for continuing the current request; if you display a page that automatically redirects to that URL after a few seconds, your application will pick up where it left off, so that the next call to RequireLocation() will either acquire the result or throw another WaitingException. (This process can be automated by designating a Waiting page ahead of time; see DefaultStatusViewRenderer. If you use that approach, you will never get a WaitingException.)

Exceptions

ExceptionCondition
Veriplace.Web..::.RespondedExceptionif the client has sent a redirect response; stop handling the request and return in this case
Veriplace.Client..::.UserDiscoveryExceptionif the user discovery request failed
Veriplace.Client..::.GetLocationNotPermittedExceptionif the location request was denied
Veriplace.Client..::.PositionFailureExceptionif the location request was valid, but a location was not available
Veriplace.Web..::.WaitingExceptionif an asynchronous request is in progress and you should display an intermediate status page
Veriplace.Client..::.UnexpectedExceptionif there was an unexpected I/O error or OAuth error from the server

See Also