Nicolò Blunda 3 Posted October 19, 2022 Hello. To get string versionName value of field inside <manifest> key, in AndroidManifest.xml file, I use this code: function GetFileVersionName: string; var PackageManager: JPackageManager; PackageInfo : JPackageInfo; Begin PackageManager:= SharedActivity.getPackageManager; PackageInfo := PackageManager.getPackageInfo(SharedActivityContext.getPackageName, TJPackageManager.JavaClass.GET_ACTIVITIES); Result := JStringToString(PackageInfo.versionName); End; If the filed is in a meta-data key, inside <activity> section, like this... <meta-data android:name="productName" android:value="HelloWorld" /> how can change above code to retrive it? Thanks. Share this post Link to post
Nicolò Blunda 3 Posted November 1, 2022 (edited) 0 Find the solution! After move <meta-data> key outside <activity> section, code to read value for name="productName" is: function GetProductName: string; var PackManager: JPackageManager; AppInfo : JApplicationInfo; Begin PackManager:= SharedActivity.getPackageManager; AppInfo := PackManager.getApplicationInfo(SharedActivityContext.getPackageName, TJPackageManager.JavaClass.GET_META_DATA); Result := JStringToString(AppInfo.metadata.getString(StringToJString('productName'))); End; Edited November 1, 2022 by Nicolò Blunda Share this post Link to post