1 page.title=GPS 2 pdk.version=1.0 3 doc.type=porting 4 @jd:body 5 6 <div id="qv-wrapper"> 7 <div id="qv"> 8 <h2>In this document</h2> 9 <a name="toc"/> 10 <ul> 11 <li><a href="#androidGPSBuildingDriver">Building a GPS Library</a></li> 12 <li><a href="#androidGPSInterface">Interface</a></li> 13 </ul> 14 </div> 15 </div> 16 17 <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> 18 19 20 <a name="androidGPSBuildingDriver"></a><h3>Building a GPS Library</h3> 21 22 <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> 23 24 <p>The following stub <code>Android.mk</code> file ensures that <code>libgps</code> compiles and links to the appropriate libraries:</p> 25 26 <pre class="prettify"> 27 LOCAL_PATH := $(call my-dir) 28 include $(CLEAR_VARS) 29 30 LOCAL_MODULE := libgps 31 32 LOCAL_STATIC_LIBRARIES:= \ 33 # include any static library dependencies 34 35 LOCAL_SHARED_LIBRARIES := \ 36 # include any shared library dependencies 37 38 LOCAL_SRC_FILES += \ 39 # include your source files. eg. MyGpsLibrary.cpp 40 41 LOCAL_CFLAGS += \ 42 # include any needed compile flags 43 44 LOCAL_C_INCLUDES:= \ 45 # include any needed local header files 46 47 include $(BUILD_SHARED_LIBRARY) 48 </pre> 49 50 51 <a name="androidGPSInterface"></a><h3>Interface</h3> 52 53 54 55 <p><span class="lh3"><a name="androidDoxygenNote"></a></span> 56 57 <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> 58 59 60 <iframe onLoad="resizeDoxFrameHeight();" src="gps_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe> 61