page.title=GPS
pdk.version=1.0
doc.type=guide
@jd:body

<div id="qv-wrapper">
<div id="qv">
<h2>In this document</h2>
<a name="toc"/>
<ul>
<li><a href="#androidGPSBuildingDriver">Building a GPS Library</a></li>
<li><a href="#androidGPSInterface">Interface</a></li>
</ul>
</div>
</div>

<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>


<a name="androidGPSBuildingDriver"></a><h3>Building a GPS Library</h3>

<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>

<p>The following stub <code>Android.mk</code> file ensures that <code>libgps</code> compiles and links to the appropriate libraries:</p>

<pre class="prettify">
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE := libgps

LOCAL_STATIC_LIBRARIES:= \
# include any static library dependencies

LOCAL_SHARED_LIBRARIES := \
# include any shared library dependencies

LOCAL_SRC_FILES += \
# include your source files.  eg. MyGpsLibrary.cpp

LOCAL_CFLAGS += \
# include any needed compile flags

LOCAL_C_INCLUDES:= \
# include any needed local header files

include $(BUILD_SHARED_LIBRARY)
</pre>


<a name="androidGPSInterface"></a><h3>Interface</h3>



<p><span class="lh3"><a name="androidDoxygenNote"></a></span>

<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>


<iframe onLoad="resizeDoxFrameHeight();" src="gps_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe>
