blob: da57bef3357c05acb5b78c3b34aad5dd92eb863c [file] [log] [blame]
David Warren5f6ca4f2009-04-30 17:11:58 -07001page.title=GPS
2pdk.version=1.0
3@jd:body
4
5<a name="toc"/>
6<div style="padding:10px">
7<a href="#androidGpsIntroduction">Introduction</a><br/>
8<a href="#androidGPSBuildingDriver">Building a GPS Library</a><br/>
9<a href="#androidGPSInterface">Interface</a><br/></div></font></div>
10
11<a name="androidGpsIntroduction"></a><h2>Introduction</h2>
12
13<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>
14
15
16<a name="androidGPSBuildingDriver"></a><h2>Building a GPS Library</h2>
17
18<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>partner/acme/chipset_or_board/gps/</code> (where "acme" is your product name and "chipset_or_board" is your hardware target).</p>
19
20<p>The following stub <code>Android.mk</code> file ensures that <code>libgps</code> compiles and links to the appropriate libraries:</p>
21
22<pre class="prettify">
23LOCAL_PATH := $(call my-dir)
24include $(CLEAR_VARS)
25
26LOCAL_MODULE := libgps
27
28LOCAL_STATIC_LIBRARIES:= \
29# include any static library dependencies
30
31LOCAL_SHARED_LIBRARIES := \
32# include any shared library dependencies
33
34LOCAL_SRC_FILES += \
35# include your source files. eg. MyGpsLibrary.cpp
36
37LOCAL_CFLAGS += \
38# include any needed compile flags
39
40LOCAL_C_INCLUDES:= \
41# include any needed local header files
42
43include $(BUILD_SHARED_LIBRARY)
44</pre>
45
46
47<a name="androidGPSInterface"></a><h2>Interface</h2>
48
49
50
51<p><span class="lh2"><a name="androidDoxygenNote"></a></span>
52
53<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>
54
55
56<iframe onLoad="resizeDoxFrameHeight();" src="gps_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe>