【问题标题】:How to get GPS Time in Flutter?如何在 Flutter 中获取 GPS 时间?
【发布时间】:2021-03-29 18:56:49
【问题描述】:

我正在尝试在我的颤振应用程序中获取 GPS 时间,我能够获取设备当前时间,但因为它可以在手机设置中更改并且不能使用网络提供的时间 NTP,因为我是离线使用我的应用程序。是否有任何颤振库可以从中获取 GPS 日期和时间(不是设备时间、卫星日期和时间)或任何其他解决我的问题的方法?

【问题讨论】:

    标签: android flutter dart gps gps-time


    【解决方案1】:

    我还没有对此进行测试,但location 包似乎在LocationData 对象中提供了时间:https://github.com/Lyokone/flutterlocation

    这是时间字段: https://github.com/Lyokone/flutterlocation/blob/ab79cba664284ee44ed3f7076c1c2b3038187afc/packages/location_platform_interface/lib/src/types.dart#L81

    请注意,它可以为空,并且我已经读到时间数据并非在所有位置都可用。您可能希望将其与在线计算以供离线使用的 NTP 偏移解决方案结合使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-02
      • 2021-05-16
      • 1970-01-01
      • 2022-10-12
      • 1970-01-01
      • 2016-01-29
      相关资源
      最近更新 更多