android gnss frame
In Android, GPS data is obtained through GNSS location framework, and location is implemented in a hierarchical way, from top to bottom
- application frame: provider android.location API
Location manager: LocationManager
Location Provider: LocationProvider
Location information: Location
Location Listener: LocationListener
- Framework Services: the main documents are as follows
frameworks/base/location/java/android/location/*
frameworks/base/services/core/java/com/android/server/location/*
frameworks/base/services/core/java/com/android/server/LocationManagerService.java
frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
- JNI: Encapsulate GNSS Hal interface (IGnss) to GnssLocationProvider to use
frameworks/base/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
- HAL layer: Implementation IGnss interface and IGnss service
hardware/libhardware/include/hardware/gps.h
hardware/interfaces/gnss/1.0/ ====>android.hardware.gnss@1.0.so
hardware/interfaces/gnss/1.0/default/ ====>android.hardware.gnss@1.0-impl.so android.hardware.gnss@1.0-service
hardware/interfaces/gnss/1.1/ ====>android.hardware.gnss@1.1.so
hardware/interfaces/gnss/1.1/default/ ====>android.hardware.gnss@1.1-service
gps usage
VIM3 board has integrated USB GPS function on Android 9. It can insert GPS receiver through USB interface, and then install GPS APK, which can view the information of current position, longitude and latitude, or install map software to view positioning
Note1) It may take a long time to get the first positioning data from the start of GPS module
2) It can also be used without network, but GPS equipment needs to be placed outdoors to receive satellite signals
To use GPS positioning, you need to turn on the location switch in the settings first,Droid Settings > More settings > Device Preferences > Loacation,Location selects on,use command to query location_providers_allowed is gps
1 | 130|console:/ $ settings list secure |grep location_providers_allowed |
Apk runs as follows
Android GPS location data API description
Android frameworks encapsulates the standard API to allow applications to obtain GPS related data. For example, longitude and latitude data can be obtained through the methods in the class of frameworks/base/location/java/android/location/Location.java. For details, please refer to the Android source code frameworks/base/tests/LocationTracker, longitude and latitude api are as follows
1 | 583 /** |
The longitude and latitude information is provided by GnssLocationProvider as follows
1 | 01-01 13:11:01.483 3735 3757 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_LOCATION, 1, Location[gps 22.570539,113.863433 hAcc=1 et=+6m35s993ms alt=153.4 vel=0.03909778 vAcc=??? sA |
22.570539113.863433 represent longitude and latitude data