![]() |
AT&T API Platform SDK for Microsoft®
2.3.3
Wrapper classes that allow developers to build robust applications using .NET
|
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:
To use these methods in an application, perform the following steps:
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.
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();
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);
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);
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);