Android Get App Version programmatiquement
val versionName = requireContext().packageManager.getPackageInfo(requireContext().packageName, 0).versionName
Friendly Finch
val versionName = requireContext().packageManager.getPackageInfo(requireContext().packageName, 0).versionName
String versionName = context.getPackageManager()
.getPackageInfo(context.getPackageName(), 0).versionName;
PackageManager manager = this.getPackageManager();
PackageInfo info = manager.getPackageInfo(this.getPackageName(), PackageManager.GET_ACTIVITIES);
Toast.makeText(this,
"PackageName = " + info.packageName + "\nVersionCode = "
+ info.versionCode + "\nVersionName = "
+ info.versionName + "\nPermissions = " + info.permissions, Toast.LENGTH_SHORT).show();