当前位置: 首页 > news >正文

Android13修改系统支持gps同步时间

 Android 12以后系统支持使用gps定位(GNSS)数据来同步系统时间,但是系统默认没有打开支持,从framework下的core/res/res/values/config.xml配置中,可以看到系统默认只支持电话信号同步基站时间和网络同步时间。

<!-- Specifies priority of automatic time sources. Suggestions from higher entries in the listtake precedence over lower ones. See com.android.server.timedetector.TimeDetectorStrategy foravailable sources. -->
<string-array name="config_autoTimeSourcesPriority"><item>telephony</item><item>network</item>
</string-array>
  • telephony:使用网络身份和时区 (NITZ) 电话信号。
  • network:使用网络时间协议 (NTP) 时间服务器。

要使用gps(GNSS)时间源同步时间,首先要修改上面的config_autoTimeSourcesPriority,添加GNSS:

<!-- Specifies priority of automatic time sources. Suggestions from higher entries in the listtake precedence over lower ones.See com.android.server.timedetector.TimeDetectorStrategy for available sources. -->
<string-array name="config_autoTimeSourcesPriority"><item>telephony</item><item>network</item><item>gnss</item>
</string-array><!-- Enables the GnssTimeUpdate service. This is the global switch for enabling Gnss time basedsuggestions to TimeDetector service. See also config_autoTimeSourcesPriority. -->
<bool name="config_enableGnssTimeUpdateService">true</bool>

同时还需要修改文件里面的 config_enableGnssTimeUpdateService 的值设置为 true。

修改上面的配置以后,机器开机后,当有应用请求了gps定位,获取定位数据以后就会同步机器的时间。

如果需要每次开机都自动通过gps同步一下系统时间,可以修改系统开机完成后,去请求获取一下GPS的定位,代码很简单,直接让AI接一个类和函数,添加到开机广播中去执行就可以了。

http://www.dtcms.com/a/609426.html

相关文章:

  • Webpack到Vite:构建工具迁移实战经验总结
  • QT音乐播放器18----新歌速递播放、隐藏顶部和底部工具栏、自定义ToolTips
  • 工控一体机在超声波清洗机中的应用
  • Qt5配置MSVC2017
  • 【AI】基于YOLO11-SEG的PCB缺陷检测与分类系统实现_3
  • 2. Qt深入 线程
  • [Godot] C#基于噪声的简单TileMap地图生成
  • Linux(4)—— 基础开发工具
  • 广州好的网站设计公司如何建单位网站
  • 无损改造+智能防控,安科瑞ASCB3为古建筑与历史街区量身打造安全用电解决方案
  • 解决“Move to iOS 卡在准备中”的 9 种有效方法
  • iOS IPA 上传工具全面解析,从 Transporter 到开心上架(Appuploader)命令行的高效上架实践
  • iOS性能调优的系统化实践,从架构分层到多工具协同的全流程优化指南(开发者深度版)
  • GitHub爆火开源项目——RustScan深度拆解
  • iOS和安卓应用上架全指南:从备案到审核发布
  • 海外购物网站排名云商网站建设
  • 解决 Node.js 18+ 构建错误:digital envelope routines::unsupported 完全指南
  • 索尼PSP游戏资源下载 推荐中文汉化ios格式合集分享开源掌机模拟器都支持
  • 【赵渝强老师】OceanBase的连接与路由管理
  • 教育网站建设情况报告长安高端装备网站设计公司
  • Unity游戏打包加密方案解析
  • 考研论文引用格式 AI 校验实操:工具合集 + 技术原理
  • Linux:安装 ActiveMQ 从部署到实践
  • 思政部网站建设总结汕头cms模板建站
  • 云原生与 AI 驱动下的数据工程新图景——解读 DZone 数据工程趋势报告【附报告下载】
  • Linux——解压缩各类文件
  • 基于STM32的多功能旅行箱_329
  • 探索 Java 中的新 HTTP 客户端
  • Swagger技术
  • 100多台物理GPU服务器,每台服务器上有8张GPU卡,组网