AT&T API Platform SDK for Microsoft®  2.3.3
Wrapper classes that allow developers to build robust applications using .NET
 All Classes Namespaces Functions Enumerations Properties
Location Service Cookbook

Overview

This cookbook shows you how to develop a Device Location application using the Platform SDK for Microsoft.
The Platform SDK for Microsoft provides the following methods:

  • Get TerminalLocation

To use these methods in an application, perform the following steps:

  1. Add a reference to the SDK as shown in the About the Cookbooks section and import the ATT_MSSDK.TLv1 namespace.
  2. Create an instance of RequestFactory with the scope type RequestFactory.ScopeTypes.TL, as shown in the About the Cookbooks section.
  3. Invoke the Location Service methods using the RequestFactory instance.

Getting the location of an AT&T wireless number

Before you can invoke the Location Service method (GetTerminalLocation) in your application, you must request authorization from the AT&T Platform and receive an authorization code. The following procedure shows you how to acquire an authorization code and invoke the GetTerminalLocation method.

Step 1. Acquire OAuth redirection URL

Invoke the GetOAuthRedirect method using the RequestFactory instance to get a redirectUrl URL. This URL is the authorization endpoint of the AT&T Platform.

 string redirectUrl = this.requestFactory.GetOAuthRedirect().ToString();

Step 2. Redirect the browser to get authorization

Redirect the browser to the authorization endpoint of the AT&T Platform that was returned by the GetOAuthRedirect method. When the browser is redirected to this URL, you will be able to request user authentication and authorization.

 Response.Redirect(redirectUrl);

Step 3. Parse the Response and acquire Access Token

Retrieve the query parameter "code" from the AT&T Platform response. This is the authentication code (or Access Token). Invoke the GetAuthorizeCredentials method using the RequestFactory instance, and pass the authentication code as an argument to the method.

 string authCode = Request["code"];
 this.requestFactory.GetAuthorizeCredentials(authCode);

Step 4. Get the Location of the device

Invoke the GetTerminalLocation method using the RequestFactory instance. This method returns device location details (latitude, longitude and accuracy) from the network for an AT&T Wireless Number.

 int requestedAccuracy = "100";
 TerminalLocationTolerance tolerance = TerminalLocationTolerance.DelayTolerant;
 int acceptableAccuracy = "10000";
 DeviceLocation deviceLocationRequest = this.requestFactory.GetTerminalLocation(requestedAccuracy, tolerance, acceptableAccuracy);