如何获取未从移动日期生成的当前日期?

时间:2015-08-18 08:32:39

标签: android

我想获取不依赖于移动时间的当前日期。如果用户在移动设备中更改日期,则它将返回当前日期。如何获取移动设备未生成的当前日期?

1 个答案:

答案 0 :(得分:0)

试试这段代码:

  try {
                TimeTCPClient updateTime = new TimeTCPClient();
                try {
                    updateTime.setDefaultTimeout(60000);
                    updateTime.connect("your time server name...");
                    Log.d("TimeLog", client.getDate() + "");
                } finally {
                    updateTime.disconnect();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }