Android: how to get the name of apk file programmatically?

后端 未结 4 1283
失恋的感觉
失恋的感觉 2020-12-10 16:37

For some reasons, my app can be installed with different apk names. At launch, I would like to know what is the name of the apk file. Do you know how to do that ?

Th

4条回答
  •  情书的邮戳
    2020-12-10 17:05

    This is achieved with getPackageArchiveInfo from an already packaged apk file:

      PackageInfo package_info = pm.getPackageArchiveInfo(file_path_to_apk, 0);
    

提交回复
热议问题