由网友(人间绝色)分享简介:如何获得使用德尔福XE5一个Android应用程序的版本?我需要的VERSIONNAME的信息。How to get the version of an Android application using the Delphi XE5? I need the "versionName" information.推荐...
如何获得使用德尔福XE5一个Android应用程序的版本?我需要的VERSIONNAME的信息。
How to get the version of an Android application using the Delphi XE5? I need the "versionName" information.
推荐答案
您可以使用 getPackageInfo
中的 JPackageManager
类来获得关于你包的信息,从这里进入在 VERSIONNAME
属性来获取 VERSIONNAME
。
You can use the getPackageInfo
method of the JPackageManager
class to get information about you package, from here access the versionName
property to get the versionName
.
试试这个样品
uses
Androidapi.JNI.JavaTypes,
FMX.Helpers.Android,
Androidapi.JNI.GraphicsContentViewText;
{$R *.fmx}
procedure TForm25.Button1Click(Sender: TObject);
var
PackageManager: JPackageManager;
PackageInfo : JPackageInfo;
begin
PackageManager := SharedActivity.getPackageManager;
PackageInfo := PackageManager.getPackageInfo(SharedActivityContext.getPackageName(), TJPackageManager.JavaClass.GET_ACTIVITIES);
Edit1.Text:= JStringToString(PackageInfo.versionName);
end;
相关推荐
最新文章