Via Cà Matta 2 - Peschiera Borromeo (MI)
+39 02 00704272
info@synaptica.info

Android App Version with Delphi

Digital Innovation Partner

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}