I would like to build libloc_api.so from the Android source so that I can use of the native gps functions.
The source is in the hardware/qcom/gps/loc_api/libloc_api folder, but I’m not familiar with how to build one of these modules without building the whole source tree.
Does anyone know how I would just build the libloc_api module?
You don’t need to build the .so file so that you can link against it. It is fine to get the library from a device, e.g.
Now your Android.mk should add -Ldevicelib -lloc-api to LOCAL_LDLIBS.
Note that this library is device-specific, and your app will fail if you try to load it on devices not based on Quallcom Snapdragon SoC.
But more importantly, this library is useless unless you work on a rooted device, because production phones only permit access to GPS hardware to a system service. All apps use the GPS (and other hardware, like Camera, video codecs) through this service, and going native with NDK does not avoid the restriction.