Blog

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}

This post is also available in: Inglese

Scoprite cosa possiamo fare per il vostro business
I nostri linguaggi