Install time for Android application?

2019-02-19 19:42发布

Is there any way to determine programmatically the time at which an Android application was installed? I don't see anything in PackageInfo, etc.

--EDIT-- To clarify, App A is installed at Time X. At some later time, Time Y, App B is installed. Is there any way App B can know when App A was installed? The link How to get app install time from android indicates that reading the modify time on the source dir of the App is sufficient. Is this really correct? Why?

3条回答
Root(大扎)
2楼-- · 2019-02-19 20:13

When you install/update a non-protected app, it's apk file gets written to /data/app/package.name.apk, confusingly referenced as sourceDir (from my answer) resetting the timestamp to the current one. That's it.

查看更多
在下西门庆
3楼-- · 2019-02-19 20:13

are you trying to find the time when YOUR app was installed, or other apps? If you are only interested in your own app, you can add functionality to your app that checks if this is the first time the app has been run. if it is, get the system time and save it in a file/database. then whenever you want it, you can open the file/query the database for it.

Was this helpful?

查看更多
劫难
4楼-- · 2019-02-19 20:31

Register a BroadcastReceiver for the corresponding Intent.

查看更多
登录 后发表回答