Via Lattanzio,23 Milano
+39 02 36592025
info@synaptica.info

Android App Version with Delphi

Android App Version with Delphi

Using the JPackageInfo class is simple to retrive the version of your Android application.

This class is already wrapped by Embarcadero in the following unit:
Androidapi.JNI.GraphicsContentViewText

{code}

{$IFDEF ANDROID}

var
PackageManager: JPackageManager;
PackageInfo: JPackageInfo;
begin
PackageManager := SharedActivityContext.getPackageManager;
PackageInfo := PackageManager.getPackageInfo
(SharedActivityContext.getPackageName, 0);
result := JStringToString(PackageInfo.versionName);
End;
{$ENDIF}