More easily obtain the APK File Installation time

Source: Internet
Author: User

Many Android Developers want to design an APK for management.Program, To obtain the APK File Installation date many netizens do not quite understand. In earlier versions, android123 used the getinstalledapplications method of the packagemanager class to return an applicationinfo array. In the applicationinfo class, sourcedir can obtain the file path of the APK, in this way, the last modification time of the file class to read the file is used. However, this may cause:

1. The original creation time cannot be obtained. It may have been created very early and replaced later.

2. if this APK is in a private location, such as the app-Private directory, the app purchased with the market payment is in this location. If the root Android phone is not available, the Retrieval time also fails.

In the Android 2.3 API level of 9, The firstinstalltime and lastupdatetime fields added to the applicationinfo class can be directly obtained from the APK creation or last modification time, even paid software can be normally obtained.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.