Skip to content

Commit 5a98fef

Browse files
scottamainAndroid (Google) Code Review
authored andcommitted
Merge "docs: add dev guide for getting user location" into froyo
2 parents ca9d51b + fa4596e commit 5a98fef

File tree

6 files changed

+502
-72
lines changed

6 files changed

+502
-72
lines changed

docs/html/guide/guide_toc.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,16 @@ localized titles are added in the language order specified below.
220220
<li><a style="color:gray;">Accelerometer</a></li>
221221
</ul>
222222
</li> -->
223-
<li><a href="<?cs var:toroot ?>guide/topics/location/index.html">
224-
<span class="en">Location and Maps</span>
225-
</a></li>
223+
<li class="toggle-list">
224+
<div><a href="<?cs var:toroot ?>guide/topics/location/index.html">
225+
<span class="en">Location and Maps</span>
226+
</a></div>
227+
<ul>
228+
<li><a href="<?cs var:toroot ?>guide/topics/location/obtaining-user-location.html">
229+
<span class="en">Obtaining User Location</span>
230+
</a> <span class="new">new!</span></li>
231+
</ul>
232+
</li>
226233
<!--<li class="toggle-list">
227234
<div><a style="color:gray;">Wireless Controls</a></div>
228235
<ul>

docs/html/guide/topics/location/index.jd

Lines changed: 38 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,94 +4,63 @@ page.title=Location and Maps
44
<div id="qv-wrapper">
55
<div id="qv">
66

7-
<h2>Location and Maps quickview</h2>
7+
<h2>Quickview</h2>
88
<ul>
9-
<li>Android provides a location framework that your application can use to determine the device's location and bearing and register for updates.</li>
10-
<li>A Google Maps external library is available that lets you display and manage Maps data.</li>
9+
<li>Android provides a location framework that your application can use to determine the
10+
device's location and bearing and register for updates</li>
11+
<li>A Google Maps external library is available that lets you display and manage Maps data</li>
1112
</ul>
12-
<h2>In this document</h2>
13+
14+
<h2>Topics</h2>
1315
<ol>
14-
<li><a href="#location">Location Services</a></li>
15-
<li><a href="#maps">Google Maps External Library</a></li>
16+
<li><a href="{@docRoot}guide/topics/location/obtaining-user-location.html">Obtaining User
17+
Location</a></li>
1618
</ol>
19+
1720
<h2>See Also</h2>
1821
<ol>
19-
<li><a href="http://code.google.com/android/add-ons/google-apis/index.html">Google APIs add-on download&raquo;</a></li>
22+
<li><a
23+
href="http://code.google.com/android/add-ons/google-apis/maps-overview.html">Google
24+
Maps External Library &raquo;</a></li>
2025
</ol>
2126
</div>
2227
</div>
2328

24-
<p>Location- and maps-based applications and services are compelling for mobile device users. You can build these capabilities into your applications using the classes of the {@link android.location} package and the Google Maps external library. The sections below provide details. </p>
29+
<p>Location and maps-based applications are compelling for mobile device users. You
30+
can build these capabilities into your applications using the classes of the {@link
31+
android.location} package and the Google Maps external library. The sections below provide details.
32+
</p>
2533

2634
<h2 id="location">Location Services</h2>
2735

2836
<p>Android gives your applications access to the location services supported by
29-
the device through the classes in the <code>android.location</code> package. The
37+
the device through the classes in the {@code android.location} package. The
3038
central component of the location framework is the
31-
{@link android.location.LocationManager} system service, which provides an API to
32-
determine location and bearing if the underlying device (if it supports location
33-
capabilities). </p>
39+
{@link android.location.LocationManager} system service, which provides APIs to
40+
determine location and bearing of the underlying device (if available). </p>
3441

35-
<p>As with other system services, you do not instantiate a LocationManager directly.
36-
Rather, you request an LocationManager instance from the system by calling
37-
{@link android.content.Context#getSystemService(String) getSystemService(Context.LOCATION_SERVICE)}.
38-
The method returns a handle to a new LocationManager instance.</p>
42+
<p>As with other system services, you do not instantiate a {@link android.location.LocationManager}
43+
directly. Rather, you request an instance from the system by calling
44+
{@link android.content.Context#getSystemService(String)
45+
getSystemService(Context.LOCATION_SERVICE)}. The method returns a handle to a new {@link
46+
android.location.LocationManager} instance.</p>
3947

40-
<p>Once your application has a handle to a LocationManager instance, your application
41-
will be able to do three things:</p>
48+
<p>Once your application has a {@link android.location.LocationManager}, your application
49+
is able to do three things:</p>
4250

4351
<ul>
44-
<li>Query for the list of all LocationProviders known to the
45-
LocationManager for its last known location.</li>
46-
<li>Register/unregister for periodic updates of current location from a
47-
LocationProvider (specified either by Criteria or name).</li>
48-
<li>Register/unregister for a given Intent to be fired if the device comes
49-
within a given proximity (specified by radius in meters) of a given
50-
lat/long.</li>
52+
<li>Query for the list of all {@link android.location.LocationProvider}s for the last known
53+
user location.</li>
54+
<li>Register/unregister for periodic updates of the user's current location from a
55+
location provider (specified either by criteria or name).</li>
56+
<li>Register/unregister for a given {@link android.content.Intent} to be fired if the device
57+
comes within a given proximity (specified by radius in meters) of a given lat/long.</li>
5158
</ul>
5259

53-
<p>However, during initial development in the emulator, you may not have access to real
54-
data from a real location provider (Network or GPS). In that case, it may be necessary to
55-
spoof some data for your application using a mock location provider.</p>
56-
57-
<p class="note"><strong>Note:</strong> If you've used mock LocationProviders in
58-
previous versions of the SDK, you can no longer provide canned LocationProviders
59-
in the /system/etc/location directory. These directories will be wiped during boot-up.
60-
Please follow the new procedures outlined below.</p>
61-
62-
<h3>Providing Mock Location Data</h3>
63-
64-
<p>When testing your application on the Android emulator, there are a couple different
65-
ways to send it some mock location data: you can use the DDMS tool or the "geo" command
66-
option in the emulator console.</p>
67-
68-
<h4 id="ddms">Using DDMS</h4>
69-
<p>With the DDMS tool, you can simulate location data a few different ways:</p>
70-
<ul>
71-
<li>Manually send individual longitude/latitude coordinates to the device.</li>
72-
<li>Use a GPX file describing a route for playback to the device.</li>
73-
<li>Use a KML file describing individual placemarks for sequenced playback to the device.</li>
74-
</ul>
75-
<p>For more information on using DDMS to spoof location data, see the
76-
<a href="{@docRoot}guide/developing/tools/ddms.html#emulator-control">Using DDMS guide</a>.
77-
78-
<h4 id="geo">Using the "geo" command in the emulator console</h4>
79-
<p>Launch your application in the Android emulator and open a terminal/console in
80-
your SDK's <code>/tools</code> directory. Connect to the emulator console. Now you can use:</p>
81-
<ul><li><code>geo fix</code> to send a fixed geo-location.
82-
<p>This command accepts a longitude and latitude in decimal degrees, and
83-
an optional altitude in meters. For example:</p>
84-
<pre>geo fix -121.45356 46.51119 4392</pre>
85-
</li>
86-
<li><code>geo nmea</code> to send an NMEA 0183 sentence.
87-
<p>This command accepts a single NMEA sentence of type '$GPGGA' (fix data) or '$GPRMC' (transit data).
88-
For example:</p>
89-
<pre>geo nmea $GPRMC,081836,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E*62</pre>
90-
</li>
91-
</ul>
60+
<p>For more information, read the guide to <a
61+
href="{@docRoot}guide/topics/location/obtaining-user-location.html">Obtaining User
62+
Location</a>.</p>
9263

93-
<p>For information about how to connect to the emulator console, see
94-
<a href="{@docRoot}guide/developing/tools/emulator.html#console">Using the Emulator Console</a>.</p>
9564

9665
<h2 id="maps">Google Maps External Library</h2>
9766

@@ -128,9 +97,9 @@ Google APIs add-on, visit</p>
12897
<p style="margin-left:2em;"><a
12998
href="http://code.google.com/android/add-ons/google-apis">http://code.google.com/android/add-ons/google-apis</a></p>
13099

131-
<p>For your convenience, the Google APIs add-on is also included in the Android
132-
SDK. <!-- To learn now to use the Maps external library in your application, see
133-
[[Using External Libraries]].--></p>
100+
<p>For your convenience, the Google APIs add-on is also available as a downloadable component from
101+
the Android SDK and AVD Manager (see <a href="{@docRoot}sdk/adding-components.html">Adding SDK
102+
Components</a>).</p>
134103

135104
<p class="note"><strong>Note:</strong> In order to display Google Maps data in a
136105
MapView, you must register with the Google Maps service and obtain a Maps API

0 commit comments

Comments
 (0)