安卓gps北斗搜星源码和导航工具支持安卓12无广告
生活随笔
收集整理的這篇文章主要介紹了
安卓gps北斗搜星源码和导航工具支持安卓12无广告
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
GNSS–全球衛(wèi)星導(dǎo)航系統(tǒng)
SBAS——星基增強(qiáng)系統(tǒng)
NAVSTAR -全球定位系統(tǒng)(美國)
GALILEO_伽利略定位系統(tǒng)(歐盟)
QZSS_準(zhǔn)天頂衛(wèi)星系統(tǒng)(日本)
BEIDOU-北斗衛(wèi)星導(dǎo)航系統(tǒng)(中國)
GLONASS——格洛納斯系統(tǒng)(俄羅斯)
IRNSS——印度區(qū)域?qū)Ш较到y(tǒng)
github里的部分代碼
public class SatelliteUtils {private static final String TAG = "SatelliteUtils";/*** Returns the Global Navigation Satellite System (GNSS) for a satellite given the PRN. For* Android 6.0.1 (API Level 23) and lower. Android 7.0 and higher should use getGnssConstellationType()** @param prn PRN value provided by the GpsSatellite.getPrn() method* @return GnssType for the given PRN*/@Deprecatedpublic static GnssType getGnssType(int prn) {if (prn >= 1 && prn <= 32) {return NAVSTAR;} else if (prn == 33) {return SBAS;} else if (prn == 39) {// See Issue #205return SBAS;} else if (prn >= 40 && prn <= 41) {// See Issue #92return SBAS;} else if (prn == 46) {return SBAS;} else if (prn == 48) {return SBAS;} else if (prn == 49) {return SBAS;} else if (prn == 51) {return SBAS;} else if (prn >= 65 && prn <= 96) {// See Issue #26 for detailsreturn GLONASS;} else if (prn >= 193 && prn <= 200) {// See Issue #54 for detailsreturn QZSS;} else if (prn >= 201 && prn <= 235) {// See Issue #54 for detailsreturn BEIDOU;} else if (prn >= 301 && prn <= 336) {return GALILEO;} else {return UNKNOWN;}}/*** Returns the Global Navigation Satellite System (GNSS) for a satellite given the GnssStatus* constellation type. For Android 7.0 and higher. This is basically a translation to our* own GnssType enumeration that we use for Android 6.0.1 and lower. Note that* getSbasConstellationType() should be used to get the particular SBAS constellation type** @param gnssConstellationType constellation type provided by the GnssStatus.getConstellationType()* method* @return GnssType for the given GnssStatus constellation type*/@RequiresApi(api = Build.VERSION_CODES.N)public static GnssType getGnssConstellationType(int gnssConstellationType) {switch (gnssConstellationType) {case GnssStatus.CONSTELLATION_GPS:return NAVSTAR;case GnssStatus.CONSTELLATION_GLONASS:return GLONASS;case GnssStatus.CONSTELLATION_BEIDOU:return BEIDOU;case GnssStatus.CONSTELLATION_QZSS:return QZSS;case GnssStatus.CONSTELLATION_GALILEO:return GALILEO;case GnssStatus.CONSTELLATION_IRNSS:return IRNSS;case GnssStatus.CONSTELLATION_SBAS:return SBAS;case GnssStatus.CONSTELLATION_UNKNOWN:return UNKNOWN;default:return UNKNOWN;}}/*** Returns the SBAS constellation type for a GnssStatus.CONSTELLATION_SBAS satellite given the GnssStatus* svid. For Android 7.0 and higher.** @param svid identification number provided by the GnssStatus.getSvid() method* @return SbasType for the given GnssStatus svid for GnssStatus.CONSTELLATION_SBAS satellites*/@RequiresApi(api = Build.VERSION_CODES.N)public static SbasType getSbasConstellationType(int svid) {if (svid == 120 || svid == 123 || svid == 126 || svid == 136) {return SbasType.EGNOS;} else if (svid == 125 || svid == 140 || svid == 141) {return SbasType.SDCM;} else if (svid == 130 || svid == 143 || svid == 144) {// Also referred to as BDSBASreturn SbasType.SNAS;} else if (svid == 131 || svid == 133 || svid == 135 || svid == 138) {return SbasType.WAAS;} else if (svid == 127 || svid == 128 || svid == 139) {return SbasType.GAGAN;} else if (svid == 129 || svid == 137) {return SbasType.MSAS;}return SbasType.UNKNOWN;}/*** Returns the SBAS constellation type for a satellite for Android 6.0.1 and lower** @param svid PRN provided by the GpsSatellite.getPrn() method method* @return SbasType for the given GpsSatellite.getPrn() method*/@SuppressLint("NewApi")@Deprecatedpublic static SbasType getSbasConstellationTypeLegacy(int svid) {return getSbasConstellationType(svid + 87);}/*** Returns the satellite name for a satellite given the constellation type and svid. For* Android 7.0 and higher.** @param gnssType constellation type* @param svid identification number* @return SatelliteName for the given constellation type and svid*/@RequiresApi(api = Build.VERSION_CODES.N)public static SatelliteName getSatelliteName(GnssType gnssType, int svid) {// TODO - support more satellite namesswitch (gnssType) {case NAVSTAR:return SatelliteName.UNKNOWN;case GLONASS:return SatelliteName.UNKNOWN;case BEIDOU:return SatelliteName.UNKNOWN;case QZSS:return SatelliteName.UNKNOWN;case GALILEO:return SatelliteName.UNKNOWN;case IRNSS:return SatelliteName.UNKNOWN;case SBAS:if (svid == 120) {return SatelliteName.INMARSAT_3F2;} else if (svid == 123) {return SatelliteName.ASTRA_5B;} else if (svid == 126) {return SatelliteName.INMARSAT_3F5;} else if (svid == 131) {return SatelliteName.GEO5;} else if (svid == 133) {return SatelliteName.INMARSAT_4F3;} else if (svid == 135) {return SatelliteName.GALAXY_15;} else if (svid == 136) {return SatelliteName.SES_5;} else if (svid == 138) {return SatelliteName.ANIK;}return SatelliteName.UNKNOWN;case UNKNOWN:return SatelliteName.UNKNOWN;default:return SatelliteName.UNKNOWN;}}/*** Returns true if this device supports the Sensor.TYPE_ROTATION_VECTOR sensor, false if it* doesn't** @return true if this device supports the Sensor.TYPE_ROTATION_VECTOR sensor, false if it* doesn't*/public static boolean isRotationVectorSensorSupported(Context context) {SensorManager sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);return sensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR) != null;}/*** Returns true if the device supports the Gnss status listener, false if it does not** @return true if the device supports the Gnss status listener, false if it does not*/public static boolean isGnssStatusListenerSupported() {return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;}/*** Returns true if the platform supports providing carrier frequencies for each satellite, false if it does not** @return true if the platform supports providing carrier frequencies for each satellite, false if it does not*/public static boolean isGnssCarrierFrequenciesSupported() {return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;}/*** Returns true if the platform supports providing vertical accuracy values and this location* has vertical accuracy information, false if it does not** @return true if the platform supports providing vertical accuracy values and this location* has vertical accuracy information, false if it does not*/public static boolean isVerticalAccuracySupported(Location location) {return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && location.hasVerticalAccuracy();}/*** Returns true if the platform supports providing speed and bearing accuracy values, false if it does not** @return true if the platform supports providing speed and bearing accuracy values, false if it does not*/public static boolean isSpeedAndBearingAccuracySupported() {return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;}/*** Returns true if automatic gain control is supported for this GNSS measurement, false if it is not* @param gnssMeasurement* @return true if automatic gain control is supported for this GNSS measurement, false if it is not*/public static boolean isAutomaticGainControlSupported(GnssMeasurement gnssMeasurement) {return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && gnssMeasurement.hasAutomaticGainControlLevelDb();}/*** Returns true if carrier phase is supported for this GNSS measurement, false if it is not* @param gnssMeasurement* @return true if carrier phase is supported for this GNSS measurement, false if it is not*/@RequiresApi(api = Build.VERSION_CODES.N)public static boolean isCarrierPhaseSupported(GnssMeasurement gnssMeasurement) {return isAccumulatedDeltaRangeStateValid(gnssMeasurement.getAccumulatedDeltaRangeState())&& gnssMeasurement.getAccumulatedDeltaRangeMeters() != 0.0d;}/*** Returns the result of the GnssMeasurement.ADR_STATE_VALID bitmask being applied to the* AccumulatedDeltaRangeState from a GnssMeasurement - true if the ADR state is valid,* false if it is not* @param accumulatedDeltaRangeState accumulatedDeltaRangeState from GnssMeasurement* @return the result of the GnssMeasurement.ADR_STATE_VALID bitmask being applied to the* * AccumulatedDeltaRangeState of the given GnssMeasurement - true if the ADR state is valid,* * false if it is not*/public static boolean isAccumulatedDeltaRangeStateValid(int accumulatedDeltaRangeState) {return (GnssMeasurement.ADR_STATE_VALID & accumulatedDeltaRangeState) == GnssMeasurement.ADR_STATE_VALID;}/*** Returns true if the platform supports the Android GnssAntennaInfo (https://developer.android.com/reference/android/location/GnssAntennaInfo.Listener)* , false if it does not* @return true if the platform supports the Android GnssAntennaInfo (https://developer.android.com/reference/android/location/GnssAntennaInfo.Listener)* , false if it does not*/public static boolean isGnssAntennaInfoSupported(LocationManager manager) {if (manager == null) {return false;}if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {return manager.getGnssCapabilities().hasAntennaInfo();} else {return Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && manager.getGnssCapabilities().hasGnssAntennaInfo();}}/*** Returns true if "force full GNSS measurements" can be programmatically invoked, and false if not* @return true if "force full GNSS measurements" can be programmatically invoked, and false if not*/public static boolean isForceFullGnssMeasurementsSupported() {return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S;}/*** Returns true if the platform supports GNSS measurements, false if it does not.* @return true if the platform supports GNSS measurements, false if it does not*/@RequiresApi(api = Build.VERSION_CODES.S)public static boolean isGnssMeasurementsSupported(LocationManager manager) {return manager != null && manager.getGnssCapabilities().hasMeasurements();}/*** Returns true if the platform supports navigation messsages, false if it does not.* @return true if the platform supports navigation messsages, false if it does not*/@RequiresApi(api = Build.VERSION_CODES.S)public static boolean isNavigationMessagesSupported(LocationManager manager) {return manager != null && manager.getGnssCapabilities().hasNavigationMessages();}/*** Creates a unique key to identify this satellite using a combination of both the svid and* constellation type** @return a unique key to identify this satellite using a combination of both the svid and* constellation type*/public static String createGnssSatelliteKey(SatelliteStatus status) {if (status.getGnssType() == SBAS) {return status.getSvid() + " " + status.getGnssType() + " " + status.getSbasType();} else {// GNSSreturn status.getSvid() + " " + status.getGnssType();}}/*** Creates a unique key to identify a particular signal, or GnssStatus, from a satellite using a* combination of both the svid and constellation type and carrier frequency** @return a unique key to identify a particular signal, or GnssStatus, from a satellite using a* combination of both the svid and constellation type and carrier frequency*/public static String createGnssStatusKey(SatelliteStatus status) {String carrierLabel = CarrierFreqUtils.getCarrierFrequencyLabel(status);if (status.getGnssType() == SBAS) {return status.getSvid() + " " + status.getGnssType() + " " + status.getSbasType() + " " + carrierLabel;} else {// GNSSreturn status.getSvid() + " " + status.getGnssType() + " " + carrierLabel;}} }
源碼下載地址
https://gitee.com/hyx_blank/gpstest
apk天翼云下載地址需掃碼注冊(cè)天翼賬號(hào)
https://cloud.189.cn/t/A7JNnqF3EnEz
總結(jié)
以上是生活随笔為你收集整理的安卓gps北斗搜星源码和导航工具支持安卓12无广告的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: split命令切割文件
- 下一篇: iso20000