【问题标题】:Handling data from external Bluetooth device with GPS NMEA strings使用 GPS NMEA 字符串处理来自外部蓝牙设备的数据
【发布时间】:2014-08-06 08:42:08
【问题描述】:

我们有外部蓝牙设备,可以向安卓设备提供不同类型的数据。除其他外,它还提供 GPS NMEA 字符串。 GPS NMEA 数据应用于更新 android 系统 GPS 模块。其他数据将在我们的应用程序中进行解析。

这怎么可能实现?

ATM:我解析了来自外部设备的所有数据,但 android GPS 模块不接收 NMEA 字符串。 GPS必须由android系统GPS模块处理才能更新导航软件。本软件仅使用安卓 GPS 数据,不支持从其他应用程序中抽取数据的功能。

【问题讨论】:

    标签: android bluetooth gps external android-bluetooth


    【解决方案1】:

    CM 版本


    有一个适用于 android >= 4.2 的 xposed 模块 https://plus.google.com/communities/104930572010612794860


    如果您没有卫星信息的问题,您也可以使用 PlayStore 中的蓝牙 Gps(需要模拟位置) https://play.google.com/store/apps/details?id=googoo.android.btgps&hl=it

    【讨论】:

    • 我在寻找开发者解决方案
    【解决方案2】:

    解决方案:我使用了模拟位置。目前无法避免 GPS NMEA 字符串解析。

    代码:

    String mocLocationProvider = LocationManager.GPS_PROVIDER;
    mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
    mLocationManager.addTestProvider(mocLocationProvider, false, false, false, false, true, true, false, Criteria.POWER_LOW, Criteria.ACCURACY_HIGH);
    mLocationManager.setTestProviderEnabled(mocLocationProvider, true);
    mLocationManager.setTestProviderStatus(mocLocationProvider, LocationProvider.AVAILABLE, null, System.currentTimeMillis());
    
    //update location
    Location mCurrentLocation = new Location(mocLocationProvider);
                               mCurrentLocation.setLatitude(mGPSCurrLat);
                               mCurrentLocation.setLongitude(mGPSCurrLon);
                               mCurrentLocation.setAccuracy(1);
                               mCurrentLocation.setTime(mGPSCurrTimeUTC); //long getTime() from UTC string
                               mCurrentLocation.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
    
    mLocationManager.setTestProviderLocation(mocLocationProvider, mCurrentLocation);
    

    注意: 在 Android 设置中启用“允许模拟位置”!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-22
      • 1970-01-01
      相关资源
      最近更新 更多