blob: f2ce11c165d4534f60be12c602dfda81aa5d705a [file] [log] [blame]
David Warren5f6ca4f2009-04-30 17:11:58 -07001page.title=GPS
2pdk.version=1.0
3@jd:body
4
David Warren5c40a482009-06-05 15:11:21 -07005<div id="qv-wrapper">
6<div id="qv">
7<h2>In this document</h2>
David Warren5f6ca4f2009-04-30 17:11:58 -07008<a name="toc"/>
David Warren5c40a482009-06-05 15:11:21 -07009<ul>
10<li><a href="#androidGPSBuildingDriver">Building a GPS Library</a></li>
11<li><a href="#androidGPSInterface">Interface</a></li>
12</ul>
13</div>
14</div>
David Warren5f6ca4f2009-04-30 17:11:58 -070015
16<p>Android defines a user space C abstraction interface for GPS hardware. The interface header is defined in <code>include/hardware/gps.h</code>. In order to integate GPS with Android, you need to build a shared library that implements this interface. </p>
17
18
David Warren5c40a482009-06-05 15:11:21 -070019<a name="androidGPSBuildingDriver"></a><h3>Building a GPS Library</h3>
David Warren5f6ca4f2009-04-30 17:11:58 -070020
Gaurav Mathur3ad1d0e2009-06-12 13:46:38 -070021<p>To implement a GPS driver, create a shared library that implements the interface defined in <code>gps.h</code>. You must name your shared library <code>libgps.so</code> so that it will get loaded from <code>/system/lib</code> at runtime. Place GPS sources and Android.mk in <code>vendor/acme/chipset_or_board/gps/</code> (where "acme" is your organization name and "chipset_or_board" is your hardware target).</p>
David Warren5f6ca4f2009-04-30 17:11:58 -070022
23<p>The following stub <code>Android.mk</code> file ensures that <code>libgps</code> compiles and links to the appropriate libraries:</p>
24
25<pre class="prettify">
26LOCAL_PATH := $(call my-dir)
27include $(CLEAR_VARS)
28
29LOCAL_MODULE := libgps
30
31LOCAL_STATIC_LIBRARIES:= \
32# include any static library dependencies
33
34LOCAL_SHARED_LIBRARIES := \
35# include any shared library dependencies
36
37LOCAL_SRC_FILES += \
38# include your source files. eg. MyGpsLibrary.cpp
39
40LOCAL_CFLAGS += \
41# include any needed compile flags
42
43LOCAL_C_INCLUDES:= \
44# include any needed local header files
45
46include $(BUILD_SHARED_LIBRARY)
47</pre>
48
49
David Warren5c40a482009-06-05 15:11:21 -070050<a name="androidGPSInterface"></a><h3>Interface</h3>
David Warren5f6ca4f2009-04-30 17:11:58 -070051
52
53
David Warren5c40a482009-06-05 15:11:21 -070054<p><span class="lh3"><a name="androidDoxygenNote"></a></span>
David Warren5f6ca4f2009-04-30 17:11:58 -070055
56<p class="note"><strong>Note</strong>: This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, <a href="gps.html">click here</a>.</p>
57
58
59<iframe onLoad="resizeDoxFrameHeight();" src="gps_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe>