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 ?
Thanks !
You can find an app's package name in the URL of your app's Google Play Store listing. For example, the URL of an app page is play.google.com/store/apps/details? id=com. example.
Simplest way: use the online tool Decompiler, upload the apk and get the source code.
The full form of APK is an Android Application Package. APK is the application file type used in the Android operating system, as well as a wide range in many other Android-based operating applications in mobile phones, video games & middleware for distribution and installation.
final PackageManager pm = getPackageManager();
String apkName = "example.apk";
String fullPath = Environment.getExternalStorageDirectory() + "/" + apkName;
PackageInfo info = pm.getPackageArchiveInfo(fullPath, 0);
you can got it with:
info.versionCod
and
info.versionName
hope this help you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With