Access GPS on Android from C++ -


i have android app serves gui little daemon (written in c++) needs run on variety of mobile/embedded linux devices. daemon needs collect gps data , pass several clients (android phones, each gui). daemon needs capable of running on 1 of same android devices being used gui, i'm having lot of trouble accessing gps data c++ daemon.

i've looked 2 options far:

1) the "stay native" method: i've heard gpsd exists android (such here http://esr.ibiblio.org/?p=4886), seems elusive and/or not existent on samsung galaxy sii, running cyanogenmod 10.1.3-i9100 (android 4.2.2). standalone toolchain built ndk doesn't seem have gps-related @ all, though sites 1 (http://www.jayway.com/2010/01/25/boosting-android-performance-using-jni/) indicate java uses jni wrappers use c code talk gps anyway.

2) the jni method: gps seems easy in android java applications, started looking jni (i'm pretty new android , java, way). supposed proved way c code , java code interact, right? read on @ site (http://journals.ecs.soton.ac.uk/java/tutorial/native1.1/implementing/index.html) , site (http://journals.ecs.soton.ac.uk/java/tutorial/native1.1/implementing/index.html) , bunch of others. occurs me haven't seen c code using jni has main() function in it. also, jni_createjavavm() function commented out in jni.h header file of ndk toolchain. in fact, can't figure out how have valid jnienv* in first place. conclusion i've come jni code meant used java applications need c support, not c applications need java support. correct?

and have third thought, don't much:

3) the "backup" method: in instances c++ daemon running on android phone, perhaps ask android gui gps data, broadcast other clients? i'm thinking might communicate through socket or simple. seems ugly solution though, because on top of seeming inefficient, daemon should able run independent of gui, depend on gui gps data.

so real question is, has else ran problem , found suitable answer? or perhaps there not understanding aobut gpsd in android, or jni in android?

thanks reading.

i recommend try use code: android gps using libhardware.

this small project use libhardware library aosp. see gps.h more information how use gps abstraction interface. worth gpslocationprovider.java , com_android_server_location_gpslocationprovider.cpp.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -