【问题标题】:Time synchronisation on Android devicesAndroid 设备上的时间同步
【发布时间】:2018-10-31 08:47:41
【问题描述】:

我在网络上有 100 多个 android 设备。这些设备不断失去时间(时间不准确 +- 几个小时或设置为默认日期时间 2010 ... 00:00 ),我想与 android NTP 同步时间和日期。我无法根植这些设备。这些设备位于没有互联网的网络上。我相信只有一种解决方案是在我们的防火墙中创建异常以允许设备连接到 android NTP 服务器???我怎样才能找到这个URL。这是sync日期时间的另一种选择吗?

【问题讨论】:

    标签: android date time synchronization


    【解决方案1】:

    通过以下代码获取上网时间:sn-p:

    public long getInternetTime() {
        SntpClient client = new SntpClient();
        if (client.requestTime("time.nist.gov", 10000)) {
            long time = client.getNtpTime();
            return time;
        }
        else {
            Log.e(TAG, "get internet time failed");
        }
        return -1;
    }
    

    【讨论】:

    • 我不是安卓开发者。我需要将时间与互联网时间同步(默认 android NTP),但我看不到女巫服务器正在使用中。因为我的设备没有root
    • 你必须使用默认的android ntp服务器吗?
    • 我无法启动我的设备,所以是的,我必须使用默认 NTP
    • 在我的回答中,您可以使用 ntp 而无需 root 设备
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-20
    • 2015-10-29
    • 1970-01-01
    • 1970-01-01
    • 2015-06-01
    • 1970-01-01
    相关资源
    最近更新 更多