|
@@ -143,6 +143,8 @@ type
|
|
|
|
|
|
/// <summary>Returns Application package name</summary>
|
|
/// <summary>Returns Application package name</summary>
|
|
class function GetPackageName: string; static;
|
|
class function GetPackageName: string; static;
|
|
|
|
+ /// <summary>Returns Application package label</summary>
|
|
|
|
+ class function GetPackageLabel: string; static;
|
|
/// <summary>Returns MimeType from filename</summary>
|
|
/// <summary>Returns MimeType from filename</summary>
|
|
class function GetMimeType(AFileName: string): JString; static;
|
|
class function GetMimeType(AFileName: string): JString; static;
|
|
/// <summary>Returns Primary SDCard path</summary>
|
|
/// <summary>Returns Primary SDCard path</summary>
|
|
@@ -470,6 +472,23 @@ begin
|
|
Result := Result.trim();
|
|
Result := Result.trim();
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+class function TAndroidHelperEx.GetPackageLabel: string;
|
|
|
|
+var
|
|
|
|
+ LApplicationInfo: JApplicationInfo;
|
|
|
|
+ LLabel: JCharSequence;
|
|
|
|
+begin
|
|
|
|
+ Result := '';
|
|
|
|
+ try
|
|
|
|
+ LApplicationInfo := Context.getPackageManager.getApplicationInfo(Context.getPackageName, 0);
|
|
|
|
+ if LApplicationInfo <> nil then begin
|
|
|
|
+ LLabel := Context.getPackageManager.getApplicationLabel(LApplicationInfo);
|
|
|
|
+ if LLabel <> nil then
|
|
|
|
+ Result := JCharSequenceToStr(LLabel);
|
|
|
|
+ end;
|
|
|
|
+ except
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
class function TAndroidHelperEx.GetPackageName: string;
|
|
class function TAndroidHelperEx.GetPackageName: string;
|
|
begin
|
|
begin
|
|
Result := JStringToString(Context.getPackageName);
|
|
Result := JStringToString(Context.getPackageName);
|
|
@@ -490,8 +509,15 @@ class function TAndroidHelperEx.GetTargetSdkVersion: Integer;
|
|
var
|
|
var
|
|
LApplicationInfo: JApplicationInfo;
|
|
LApplicationInfo: JApplicationInfo;
|
|
begin
|
|
begin
|
|
- LApplicationInfo := Context.getPackageManager.getApplicationInfo(Context.getPackageName, 0);
|
|
|
|
- Result := LApplicationInfo.targetSdkVersion;
|
|
|
|
|
|
+ try
|
|
|
|
+ LApplicationInfo := Context.getPackageManager.getApplicationInfo(Context.getPackageName, 0);
|
|
|
|
+ if LApplicationInfo <> nil then
|
|
|
|
+ Result := LApplicationInfo.targetSdkVersion
|
|
|
|
+ else
|
|
|
|
+ Result := -1;
|
|
|
|
+ except
|
|
|
|
+ Result := -1;
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
class function TAndroidHelperEx.HasAssocApp(const Intent: JIntent): Boolean;
|
|
class function TAndroidHelperEx.HasAssocApp(const Intent: JIntent): Boolean;
|