Android的资产时间戳

Android的资产时间戳

本文介绍了Android的资产时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,资产文件的时间戳设置为构建日期。如何preserve在资产夹中的文件的时间戳APK生成时?
而且是有可能检索此时间戳?

I noticed that the timestamp of assets files is set to the build date. How to preserve the timestamp of files in the assets folder when the apk is built?And is it possible to retrieve this timestamp?

推荐答案

您可以尝试获得 .apk文件文件的保持状态,试图解压缩它与帮助一个 ZipInputStream为了得到在条目

You might try to get hold of the .apk file and try to "unzip" it with the help of a ZipInputStream in order to get at the entries.

但正如你说,这会给你(荏苒它之前可能是因为构建链正在复制文件到目标目录)生成日期的时间戳。

But as you say this will give you the timestamps of the build date (probably because the build chain is copying the files into a target directory before zipping it up).

你可以做的是添加一个文件到资产,握着你的理想时间戳为内容然后你可以在你的应用程序打开和读取的时间戳。

What you could do is to add a file into assets, which holds your "desired timestamp" as content and which you could then open in your app and read the timestamp from.

这篇关于Android的资产时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 07:58